From 82231641b742fb95288754957b4bf97439764b9d Mon Sep 17 00:00:00 2001 From: Dave Machado Date: Sat, 27 Jan 2018 00:36:57 -0500 Subject: [PATCH 1/2] add checks for category minimums and anchor format --- build/validate_format.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/build/validate_format.py b/build/validate_format.py index 8066c824..545f5e15 100755 --- a/build/validate_format.py +++ b/build/validate_format.py @@ -1,10 +1,12 @@ #!/usr/bin/env python3 import json +import re import string import sys anchor = '###' +min_entries_per_section = 3 auth_keys = ['apiKey', 'OAuth', 'X-Mashape-Key', 'No'] punctuation = ['.', '?', '!'] https_keys = ['Yes', 'No'] @@ -55,9 +57,23 @@ def check_format(filename): # END Alphabetical Order # START Check Entries + num_in_category = min_entries_per_section + 1 + anchor_re = re.compile('###\s\S+') for line_num, line in enumerate(lines): + # check each section for the minimum number of entries + if line.startswith(anchor): + if not anchor_re.match(line): + add_error(line_num, "section header is not formatted correctly") + if num_in_category < min_entries_per_section: + add_error(category_line, "{} section does not have the minimum {} entries (only has {})".format( + category, min_entries_per_section, num_in_category)) + category = line.split(' ')[1] + category_line = line_num + num_in_category = 0 + continue if not line.startswith('|') or line.startswith('|---'): continue + num_in_category += 1 segments = line.split('|')[1:-1] # START Global for segment in segments: @@ -75,7 +91,7 @@ def check_format(filename): # first character should be capitalized char = segments[index_desc][0] if char.upper() != char: - add_error(line_num, "first char of Description is not capitalized") + add_error(line_num, "first character of description is not capitalized") # last character should not punctuation char = segments[index_desc][-1] if char in punctuation: @@ -103,7 +119,7 @@ def check_format(filename): # url should be wrapped in '[Go!]()' Markdown syntax link = segments[index_link] if not link.startswith('[Go!](http') or not link.endswith(')'): - add_error(line_num, 'link format should be "[Go!](LINK)"') + add_error(line_num, 'link syntax should be "[Go!](LINK)"') # END Link # END Check Entries From c1e88d0a966f5d33964e38350d32f3f87f42ab21 Mon Sep 17 00:00:00 2001 From: Dave Machado Date: Sat, 27 Jan 2018 00:37:46 -0500 Subject: [PATCH 2/2] Update sections to conform to new minimum of 3 --- README.md | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index fe2802b5..383c52be 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,6 @@ Please note a passing build status indicates all listed APIs are available since * [Health](#health) * [Jobs](#jobs) * [Machine Learning](#machine-learning) -* [Math](#math) * [Music](#music) * [News](#news) * [Open Data](#open-data) @@ -44,7 +43,7 @@ Please note a passing build status indicates all listed APIs are available since * [Patent](#patent) * [Personality](#personality) * [Photography](#photography) -* [Science](#science) +* [Science & Math](#science--math) * [Security](#security) * [Shopping](#shopping) * [Social](#social) @@ -53,7 +52,6 @@ Please note a passing build status indicates all listed APIs are available since * [Text Analysis](#text-analysis) * [Tracking](#tracking) * [Transportation](#transportation) -* [University](#university) * [URL Shorteners](#url-shorteners) * [Vehicle](#vehicle) * [Video](#video) @@ -424,12 +422,6 @@ API | Description | Auth | HTTPS | CORS | Link | | Unplugg | Forecasting API for timeseries data | `apiKey` | Yes | Unknown | [Go!](https://unplu.gg/test_api.html) | | Wit.ai | Natural Language Processing | `OAuth` | Yes | Unknown | [Go!](https://wit.ai/) | -### Math -API | Description | Auth | HTTPS | CORS | Link | -|---|---|---|---|---|---| -| Newton | Symbolic and Arithmetic Math Calculator | No | Yes | Unknown | [Go!](https://newton.now.sh/) | -| Numbers | Facts about numbers | No | No | Unknown | [Go!](http://numbersapi.com) | - ### Music API | Description | Auth | HTTPS | CORS | Link | |---|---|---|---|---|---| @@ -494,6 +486,7 @@ API | Description | Auth | HTTPS | CORS | Link | | Represent by Open North | Find Canadian Government Representatives | No | Yes | Unknown | [Go!](https://represent.opennorth.ca/) | | Scoop.it | Content Curation Service | `apiKey` | No | Unknown | [Go!](http://www.scoop.it/dev) | | Teleport | Quality of Life Data | No | Yes | Unknown | [Go!](https://developers.teleport.org/) | +| Universities List | University names, countries and domains | No | Yes | Unknown | [Go!](https://github.com/Hipo/university-domains-list) | | UPC database | More than 1.5 million barcode numbers from all around the world | `apiKey` | Yes | Unknown | [Go!](https://upcdatabase.org/api) | | Wikidata | Collaboratively edited knowledge base operated by the Wikimedia Foundation | `OAuth` | Yes | Unknown | [Go!](https://www.wikidata.org/w/api.php?action=help) | | Wikipedia | Mediawiki Encyclopedia | No | Yes | Unknown | [Go!](https://www.mediawiki.org/wiki/API:Main_page) | @@ -541,7 +534,7 @@ API | Description | Auth | HTTPS | CORS | Link | | ScreenShotLayer | URL 2 Image | No | Yes | Unknown | [Go!](https://screenshotlayer.com) | | Unsplash | Photography | `OAuth` | Yes | Unknown | [Go!](https://unsplash.com/developers) | -### Science +### Science & Math API | Description | Auth | HTTPS | CORS | Link | |---|---|---|---|---|---| | arcsecond.io | Multiple astronomy data sources | No | Yes | Unknown | [Go!](https://api.arcsecond.io/) | @@ -550,6 +543,8 @@ API | Description | Auth | HTTPS | CORS | Link | | Launch Library | Upcoming Space Launches | No | Yes | Unknown | [Go!](https://launchlibrary.net/docs/1.3/api.html) | | Minor Planet Center | Asterank.com Information | No | No | Unknown | [Go!](http://www.asterank.com/mpc) | | NASA | NASA data, including imagery | No | Yes | Unknown | [Go!](https://api.nasa.gov) | +| Newton | Symbolic and Arithmetic Math Calculator | No | Yes | Unknown | [Go!](https://newton.now.sh/) | +| Numbers | Facts about numbers | No | No | Unknown | [Go!](http://numbersapi.com) | | Open Notify | ISS astronauts, current location, etc | No | No | Unknown | [Go!](http://open-notify.org/Open-Notify-API/) | | Open Science Framework | Repository and archive for study designs, research materials, data, manuscripts, etc | No | Yes | Unknown | [Go!](https://developer.osf.io) | | SHARE | A free, open, dataset about research and scholarly activities | No | Yes | Unknown | [Go!](https://share.osf.io/api/v2/) | @@ -651,6 +646,7 @@ API | Description | Auth | HTTPS | CORS | Link | |---|---|---|---|---|---| | Postmon | An API to query Brazilian ZIP codes and orders easily, quickly and free | No | No | Unknown | [Go!](http://postmon.com.br) | | Sweden | Provides information about parcels in transport | `apiKey` | No | Unknown | [Go!](https://developer.postnord.com/docs2) | +| UPS | Shipment and Address information | `apiKey` | Yes | Unknown | [Go!](https://www.ups.com/upsdeveloperkit) | ### Transportation API | Description | Auth | HTTPS | CORS | Link | @@ -703,11 +699,6 @@ API | Description | Auth | HTTPS | CORS | Link | | Transport for Washington, US | Washington Metro transport API | `OAuth` | Yes | Unknown | [Go!](https://developer.wmata.com/) | | WhereIsMyTransport | Platform for public transport data in emerging cities | `OAuth` | Yes | Unknown | [Go!](https://developer.whereismytransport.com/) | -### University -API | Description | Auth | HTTPS | CORS | Link | -|---|---|---|---|---|---| -| Universities List | University names, countries and domains | No | Yes | Unknown | [Go!](https://github.com/Hipo/university-domains-list) | - ### URL Shorteners API | Description | Auth | HTTPS | CORS | Link | |---|---|---|---|---|---| @@ -720,6 +711,7 @@ API | Description | Auth | HTTPS | CORS | Link | API | Description | Auth | HTTPS | CORS | Link | |---|---|---|---|---|---| | Brazilian Vehicles and Prices | Vehicles information from Fundação Instituto de Pesquisas Econômicas - Fipe | No | Yes | Unknown | [Go!](https://deividfortuna.github.io/fipe/) | +| Kelley Blue Book | Vehicle info, pricing, configuration, plus much more | `apiKey` | Yes | No | [Go!](http://developer.kbb.com/#!/data/1-Default) | | NHTSA | NHTSA Product Information Catalog and Vehicle Listing | No | Yes | Unknown | [Go!](https://vpic.nhtsa.dot.gov/api/) | ### Video