Validate company sort order in readme; try out comment bot (#382)

* Left over from previous changes

* Validate company sort order in readme

* Changes to support validating PR branches

In order to make this work without potentially running untrusted code,
we need to run the validation scripts from a separate place than the
content being validated.

* Fix typo

The output of the validation script should be the same, so this commit
should not generate another bot message.

* Fix most of the readme sort order

The PR should get a new bot message after this.

* Fix remaining sort order issues and remove a duplicate company
This commit is contained in:
James Nylen 2017-12-29 05:40:05 -05:00 committed by Doug Aitken
parent 1d19ab3730
commit 3bbfe49a51
2 changed files with 36 additions and 13 deletions

View file

@ -64,7 +64,6 @@ Bulut Yazilim | https://bulutyazilim.com/ | Worldwide
BuySellAds | https://www.buysellads.com/ | BuySellAds | https://www.buysellads.com/ |
[Canonical](/company-profiles/canonical.md) | http://www.canonical.com/ | Worldwide [Canonical](/company-profiles/canonical.md) | http://www.canonical.com/ | Worldwide
Carbon Black | https://www.carbonblack.com/ | USA, Offices in Boston, MA Carbon Black | https://www.carbonblack.com/ | USA, Offices in Boston, MA
[Codestunts](/company-profiles/codestunts.md) | https://codestunts.com/ | Worldwide
Cards Against Humanity | https://cardsagainsthumanity.com/ | Cards Against Humanity | https://cardsagainsthumanity.com/ |
[CareMessage](/company-profiles/caremessage.md) | http://caremessage.org/careers | Worldwide [CareMessage](/company-profiles/caremessage.md) | http://caremessage.org/careers | Worldwide
[CartoDB](/company-profiles/cartodb.md) | https://cartodb.com/ | Worldwide [CartoDB](/company-profiles/cartodb.md) | https://cartodb.com/ | Worldwide
@ -81,6 +80,7 @@ CircleCI | https://circleci.com/ |
[Codea IT](/company-profiles/codea-it.md) | http://www.codeait.com | Worldwide [Codea IT](/company-profiles/codea-it.md) | http://www.codeait.com | Worldwide
[CodePen](/company-profiles/codepen.md) | https://codepen.io | Worldwide [CodePen](/company-profiles/codepen.md) | https://codepen.io | Worldwide
Codeship | https://codeship.com/ | Codeship | https://codeship.com/ |
[Codestunts](/company-profiles/codestunts.md) | https://codestunts.com/ | Worldwide
[Colivre](/company-profiles/colivre.md) | http://colivre.coop.br/ | Worldwide [Colivre](/company-profiles/colivre.md) | http://colivre.coop.br/ | Worldwide
Collabora | https://www.collabora.com/ | Collabora | https://www.collabora.com/ |
Compose | https://www.compose.io/ | Compose | https://www.compose.io/ |
@ -88,19 +88,19 @@ Compose | https://www.compose.io/ |
Consumer Financial Protection Bureau | http://www.consumerfinance.gov | Consumer Financial Protection Bureau | http://www.consumerfinance.gov |
Continu | https://www.continu.co/ | Continu | https://www.continu.co/ |
[Conversio](/company-profiles/conversio.md) | https://conversio.com/ | Worldwide [Conversio](/company-profiles/conversio.md) | https://conversio.com/ | Worldwide
[Convert](/company-profiles/convert.md) | https://www.convert.com | Worldwide
Core-Apps | http://www.core-apps.com/ | USA Core-Apps | http://www.core-apps.com/ | USA
CoreOS | https://coreos.com/ | CoreOS | https://coreos.com/ |
[Convert](/company-profiles/convert.md) | https://www.convert.com | Worldwide
[Corgibytes](/company-profiles/corgibytes.md) | http://corgibytes.com | US East Coast [Corgibytes](/company-profiles/corgibytes.md) | http://corgibytes.com | US East Coast
[Customer.io](/company-profiles/customer-io.md) | https://customer.io | Worldwide
[Crew](/company-profiles/crew.md) | https://crew.co | Worldwide [Crew](/company-profiles/crew.md) | https://crew.co | Worldwide
Crossover | https://www.crossover.com | Worldwide Crossover | https://www.crossover.com | Worldwide
[CrowdTangle](/company-profiles/crowdtangle.md) | http://crowdtangle.com | USA [CrowdTangle](/company-profiles/crowdtangle.md) | http://crowdtangle.com | USA
[Customer.io](/company-profiles/customer-io.md) | https://customer.io | Worldwide
[Dalenys](/company-profiles/dalenys.md) | https://dalenys.com/ | Europe [Dalenys](/company-profiles/dalenys.md) | https://dalenys.com/ | Europe
Datica | https://datica.com/ |
[Datadog](/company-profiles/datadog.md) | https://www.datadoghq.com/ | Worldwide
[Data Science Brigade](/company-profiles/data-science-brigade.md) | http://datasciencebr.com/ | Worldwide [Data Science Brigade](/company-profiles/data-science-brigade.md) | http://datasciencebr.com/ | Worldwide
[Datadog](/company-profiles/datadog.md) | https://www.datadoghq.com/ | Worldwide
DataStax | http://www.datastax.com/ | DataStax | http://www.datastax.com/ |
Datica | https://datica.com/ |
DealDash | http://www.dealdash.com | DealDash | http://www.dealdash.com |
Delighted | https://delighted.com | Delighted | https://delighted.com |
[Dgraph](/company-profiles/dgraph.md) | https://dgraph.io/ | Americas [Dgraph](/company-profiles/dgraph.md) | https://dgraph.io/ | Americas
@ -162,10 +162,10 @@ Hanno | https://hanno.co/ |
Happy Cog | http://happycog.com/ | USA Happy Cog | http://happycog.com/ | USA
[Harvest](/company-profiles/harvest.md) | https://www.getharvest.com/ | Worldwide [Harvest](/company-profiles/harvest.md) | https://www.getharvest.com/ | Worldwide
HashiCorp | https://www.hashicorp.com/ | HashiCorp | https://www.hashicorp.com/ |
[HE:labs](/company-profiles/he-labs.md) | https://www.helabs.com | Worldwide
Healthfinch | http://www.healthfinch.com/ | Healthfinch | http://www.healthfinch.com/ |
[Heap](/company-profiles/heap.md) | https://heapanalytics.com/ | Worldwide [Heap](/company-profiles/heap.md) | https://heapanalytics.com/ | Worldwide
Help Scout | https://www.helpscout.net/ | Help Scout | https://www.helpscout.net/ |
[HE:labs](/company-profiles/he-labs.md) | https://www.helabs.com | Worldwide
Heroku | https://www.heroku.com/ | Heroku | https://www.heroku.com/ |
[Hireology](/company-profiles/hireology.md) | https://www.hireology.com | United States [Hireology](/company-profiles/hireology.md) | https://www.hireology.com | United States
Honeybadger | https://www.honeybadger.io/ | Honeybadger | https://www.honeybadger.io/ |
@ -293,10 +293,9 @@ Soostone | http://www.soostone.com/ |
[Spoqa](/company-profiles/spoqa.md) | http://www.spoqa.com/ | South Korea and Japan [Spoqa](/company-profiles/spoqa.md) | http://www.spoqa.com/ | South Korea and Japan
[Spreedly](/company-profiles/spreedly.md) | https://spreedly.com/ | United States [Spreedly](/company-profiles/spreedly.md) | https://spreedly.com/ | United States
[Stack Exchange](/company-profiles/stack-exchange.md) | http://stackexchange.com/ | Worldwide [Stack Exchange](/company-profiles/stack-exchange.md) | http://stackexchange.com/ | Worldwide
[Stencil](/company-profiles/stencil.md) | https://getstencil.com/ | United States and Canada
Stitch Fix | https://www.stitchfix.com |
[Stairlin](/company-profiles/stairlin.md) | https://www.stairlin.com/ | Worldwide [Stairlin](/company-profiles/stairlin.md) | https://www.stairlin.com/ | Worldwide
Stitch Fix | https://www.stitchfix.com | [Stencil](/company-profiles/stencil.md) | https://getstencil.com/ | United States and Canada
Stitch Fix | https://www.stitchfix.com |
[Stripe](/company-profiles/stripe.md) | https://stripe.com/ | Worldwide [Stripe](/company-profiles/stripe.md) | https://stripe.com/ | Worldwide
Strongloop | https://strongloop.com/ | Strongloop | https://strongloop.com/ |
[StudySoup](/company-profiles/studysoup.md) | https://studysoup.com/ | Worldwide [StudySoup](/company-profiles/studysoup.md) | https://studysoup.com/ | Worldwide
@ -351,7 +350,7 @@ WikiHow | http://www.wikihow.com/wikiHow:About-wikiHow | PST Timezone
Wombat Security Technologies | https://www.wombatsecurity.com/ | USA Wombat Security Technologies | https://www.wombatsecurity.com/ | USA
Word to the Wise | https://wordtothewise.com | Word to the Wise | https://wordtothewise.com |
X-Team | http://x-team.com/ | X-Team | http://x-team.com/ |
YouCanBook.me Ltd | https://youcanbook.me |
Yonder | https://www.yonder.io | Worldwide Yonder | https://www.yonder.io | Worldwide
YouCanBook.me Ltd | https://youcanbook.me |
[Zapier](/company-profiles/zapier.md) | https://zapier.com/ | Worldwide [Zapier](/company-profiles/zapier.md) | https://zapier.com/ | Worldwide
[Zeit.io](/company-profiles/zeit-io.md) | http://zeit.io/ | Germany, The Netherlands, Spain, Chile [Zeit.io](/company-profiles/zeit-io.md) | http://zeit.io/ | Germany, The Netherlands, Spain, Chile

View file

@ -9,11 +9,21 @@ const marked = require( 'marked' );
let errorCount = 0; let errorCount = 0;
/**
* Accept an optional directory name where the content files live.
*/
const contentPath = (
process.argv[ 2 ]
? path.resolve( process.argv[ 2 ] )
: path.join( __dirname, '..' )
);
/** /**
* Build list of Markdown files containing company profiles. * Build list of Markdown files containing company profiles.
*/ */
const profilesPath = path.join( __dirname, '..', 'company-profiles' ); const profilesPath = path.join( contentPath, 'company-profiles' );
const profileFilenames = fs.readdirSync( profilesPath ); const profileFilenames = fs.readdirSync( profilesPath );
@ -24,7 +34,7 @@ const profileFilenames = fs.readdirSync( profilesPath );
const readmeCompanies = []; const readmeCompanies = [];
const readmeMarkdown = fs.readFileSync( const readmeMarkdown = fs.readFileSync(
path.join( __dirname, '..', 'README.md' ), path.join( contentPath, 'README.md' ),
'utf8' 'utf8'
); );
@ -38,6 +48,8 @@ function readmeError( msg, ...params ) {
); );
} }
let lastCompanyName = null;
$( 'tr' ).each( ( i, tr ) => { $( 'tr' ).each( ( i, tr ) => {
if ( i === 0 ) { if ( i === 0 ) {
// Skip the table header row. // Skip the table header row.
@ -61,10 +73,22 @@ $( 'tr' ).each( ( i, tr ) => {
if ( ! entry.name ) { if ( ! entry.name ) {
readmeError( readmeError(
'Missing company name: %s', 'Missing company name: %s',
$( tr ).html() $( tr ).html().replace( /\n/g, '' )
); );
} }
if (
lastCompanyName &&
entry.name.toLowerCase() < lastCompanyName.toLowerCase()
) {
readmeError(
'Company is listed out of order: "%s" (should be before "%s")',
entry.name,
lastCompanyName
);
}
lastCompanyName = entry.name;
const profileLink = $td.eq( 0 ).find( 'a' ).attr( 'href' ); const profileLink = $td.eq( 0 ).find( 'a' ).attr( 'href' );
if ( profileLink ) { if ( profileLink ) {