Add syntax checks to Dangerfile

This commit is contained in:
nrew225 2016-10-25 16:52:07 -07:00
parent b0e2f06a8b
commit c2f87c6cc2
3 changed files with 18 additions and 3 deletions

View File

@ -9,6 +9,14 @@ warn 'Please rebase to get rid of the merge commits in this Pull Request' if git
require 'json'
results = File.read 'ab-results-README.md-markdown-table.json'
j = JSON.parse results
if j['error']==true
fail j['title']
markdown j['message']
# Check syntx
require 'json'
results = File.read 'syntaxcheck.json'
j = JSON.parse results
if j['error']==true
fail j['title']
markdown j['message']

View File

@ -95,7 +95,7 @@ See [Contributing](#contributing).
_Web Analytics_
* [AWStats](http://www.awstats.org/) - Generates web, streaming, ftp or mail server statistics graphically. ([Source Code](https://github.com/eldy/awstats)) `GPLv3` `Perl`
* [AWStats](http://www.awstats.org/) Generates web, streaming, ftp or mail server statistics graphically. ([Source Code](https://github.com/eldy/awstats)) `GPLv3` `Perl`
* [Countly](https://count.ly) - Real time mobile & web analytics, crash reporting and push notifications platform. ([Source Code](https://github.com/countly)) `AGPLv3` `Javascript`
* [Druid](http://druid.io/) - A distributed, column-oriented, real-time analytics data store. ([Source Code](https://github.com/druid-io/druid/)) `Apache` `Java`
* [GoAccess](http://goaccess.io/) - Real-time web log analyzer and interactive viewer that runs in a terminal. ([Source Code](https://github.com/allinurl/goaccess)) `GPLv2` `C`

11
test.js
View File

@ -1,5 +1,7 @@
const fs = require('fs');
var testStatus;
var log = "{\n";
var issuelog = '"message": "Line | Entry\\n----|----------------------\\n';
var file = fs.readFileSync('README.md', 'utf8')
entryErrorCheck(file);
@ -28,17 +30,22 @@ function entryErrorCheck(md) {
totalPass += 1;
//console.log(i + 1 + ". Pass: " + entryArray[i].name);
} else {
console.log("Line #" + (i + 1) + ". Fail: " + entryArray[i].name);
console.log("Line #" + (i + 1) + ". Fail: " + entryArray[i].name + "\\n");
//console.log(entries[i]);
totalFail += 1;
issuelog += (i + 1) + " | " + entryArray[i].name;
}
}
}
if (totalFail > 0) {
console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total);
log += '"error": "true",\n"title": "Found ' + totalFail + ' syntax error(s).",\n';
fs.writeFileSync('syntaxcheck.json', log + issuelog + '"\n}');
process.exit(1);
} else {
console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total);
console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total + "\n");
log += '"error": false,\n"title": "No errors found!"\n}';
fs.writeFileSync('syntaxcheck.json', log);
process.exit(0);
}
//console.log(entries[i])