Add syntax checks to Dangerfile
This commit is contained in:
parent
b0e2f06a8b
commit
c2f87c6cc2
@ -9,6 +9,14 @@ warn 'Please rebase to get rid of the merge commits in this Pull Request' if git
|
|||||||
require 'json'
|
require 'json'
|
||||||
results = File.read 'ab-results-README.md-markdown-table.json'
|
results = File.read 'ab-results-README.md-markdown-table.json'
|
||||||
j = JSON.parse results
|
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
|
if j['error']==true
|
||||||
fail j['title']
|
fail j['title']
|
||||||
markdown j['message']
|
markdown j['message']
|
||||||
|
@ -95,7 +95,7 @@ See [Contributing](#contributing).
|
|||||||
|
|
||||||
_Web Analytics_
|
_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`
|
* [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`
|
* [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`
|
* [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
11
test.js
@ -1,5 +1,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
var testStatus;
|
var testStatus;
|
||||||
|
var log = "{\n";
|
||||||
|
var issuelog = '"message": "Line | Entry\\n----|----------------------\\n';
|
||||||
|
|
||||||
var file = fs.readFileSync('README.md', 'utf8')
|
var file = fs.readFileSync('README.md', 'utf8')
|
||||||
entryErrorCheck(file);
|
entryErrorCheck(file);
|
||||||
@ -28,17 +30,22 @@ function entryErrorCheck(md) {
|
|||||||
totalPass += 1;
|
totalPass += 1;
|
||||||
//console.log(i + 1 + ". Pass: " + entryArray[i].name);
|
//console.log(i + 1 + ". Pass: " + entryArray[i].name);
|
||||||
} else {
|
} else {
|
||||||
console.log("Line #" + (i + 1) + ". Fail: " + entryArray[i].name);
|
console.log("Line #" + (i + 1) + ". Fail: " + entryArray[i].name + "\\n");
|
||||||
//console.log(entries[i]);
|
//console.log(entries[i]);
|
||||||
totalFail += 1;
|
totalFail += 1;
|
||||||
|
issuelog += (i + 1) + " | " + entryArray[i].name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (totalFail > 0) {
|
if (totalFail > 0) {
|
||||||
console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total);
|
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);
|
process.exit(1);
|
||||||
} else {
|
} 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);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
//console.log(entries[i])
|
//console.log(entries[i])
|
||||||
|
Loading…
Reference in New Issue
Block a user