From cf24712581e563143e620cc3558eeff0931015ce Mon Sep 17 00:00:00 2001 From: nrew225 Date: Mon, 24 Oct 2016 22:49:08 -0700 Subject: [PATCH 1/3] Setup travis for the repo --- .travis.yml | 11 ++++++ test.js | 98 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 109 insertions(+) create mode 100644 .travis.yml create mode 100644 test.js diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..9b074161 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,11 @@ +language: node_js + +node_js: + - "node" + +before_install: + - rvm install 2.2 + - gem install awesome_bot +script: + - node test.js + - awesome_bot README.md --allow-dupe --allow-redirect diff --git a/test.js b/test.js new file mode 100644 index 00000000..88cc9ced --- /dev/null +++ b/test.js @@ -0,0 +1,98 @@ +const fs = require('fs'); +var testStatus; + +var file = fs.readFileSync('README.md', 'utf8') +entryErrorCheck(file); +return testStatus; + +function entryErrorCheck(md) { + var namepatt = /\*\s\[(.*?)\]/; + var entries = split(md); + var totalFail = 0; + var totalPass = 0; + var total = 0; + var entryArray = []; + for (var i = 0, len = entries.length; i < len; i++) { + entryArray[i] = new Object; + entryArray[i].raw = entries[i]; + //console.log(entries[i]); + //console.log(entryArray[i].raw); + //console.log(entryFilter(entries[i])); + if (entryFilter(entries[i]) === true){ + total += 1; + entryArray[i].name = namepatt.exec(entries[i])[1]; + //console.log('name' + entryArray[i].name); + //entryArray[i].error = ""; + entryArray[i].pass = findPattern(entries[i], i); + if (entryArray[i].pass == true) { + totalPass += 1; + //console.log(i + 1 + ". Pass: " + entryArray[i].name); + } else { + console.log("Line #" + (i + 1) + ". Fail: " + entryArray[i].name); + //console.log(entries[i]); + totalFail += 1; + } + } + } + if (totalFail > 0) { + console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total); + process.exit(1); + } else { + console.log(totalFail + " Failed, " + totalPass + " Passed, of " + total); + process.exit(0); + } + //console.log(entries[i]) + //console.log(totalPass + "|" + totalFail); + +}; + +function entryFilter(md) { + var linepatt = /^\s{0,4}\*\s\[.*\`/; + return linepatt.test(md); +} + +function split(text){ + //cutOne = text.split(""); + //cutTwo = cutOne[1].split(""); + //cutThree = cutTwo[0].replace(/^\#.*$|^\_.*$|^See.*$|^Some.*$|^\*.*\*$|^\s\*.*\*$|^CMS.*$|^\*\*\[.*$/mg, ""); + return text.split(/\r?\n/); +} + +function parseMD(md) { + return split(md).filter(entryFilter); + //console.log(entries); + //console.log (entries.length); + //console.log(entries[0]); + //console.log(entries[entries.length - 1]); +} + +function findPattern(text, i) { + var nodnospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with no demo and no source code + var slpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\(\[Demo\b\]\((.*?)\)\,\s\[Source Code\b\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with demo and source code + var nodpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\(\[Source Code\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with no demo + var nospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\-\s(.{0,249}?\.\s)\(\[Demo\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with no source code + var pnodnospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with no demo and no source code + var pslpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\(\[Demo\b\]\((.*?)\)\,\s\[Source Code\b\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with demo and source code + var pnodpatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\(\[Source Code\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with no demo + var pnospatt = /\s{0,3}\*\s\[(.*?)\]\((.*?)\)\s\`(\⚠)\`\s\-\s(.{0,249}?\.\s)\(\[Demo\]\((.*?)\)\)\s\`(.*?)\`\s\`(.*?)\`/; //Regex for entries with proprietary with no source code + if (nodnospatt.test(text) == true) { + return true; + } else if (slpatt.test(text) == true) { + return true; + } else if (nodpatt.test(text) == true) { + return true; + } else if (nospatt.test(text) == true) { + return true; + } else if (pnodnospatt.test(text) == true) { + return true; + } else if (pslpatt.test(text) == true) { + return true; + } else if (pnodpatt.test(text) == true) { + return true; + } else if (pnospatt.test(text) == true) { + return true; + } else { + //document.getElementById("alert").innerHTML = "Error(s) Found, check your syntax!"; + return false; + } +}; \ No newline at end of file From 94295394ab9b8775147e851f0f892af6f089f65f Mon Sep 17 00:00:00 2001 From: nrew225 Date: Tue, 25 Oct 2016 12:36:01 -0700 Subject: [PATCH 2/3] add swiperproxy demo to whitelist for now add whitelist to .travis.yml --- .travis.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9b074161..d298532b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,4 +8,11 @@ before_install: - gem install awesome_bot script: - node test.js - - awesome_bot README.md --allow-dupe --allow-redirect + - awesome_bot README.md --allow-dupe --allow-redirect -w scrollback.io,dev.sigpipe.me,svn.redmine.org,notepad.cc,www.invoiceplane.com + #Whitelisted Reason + #scrollback.io certificate issue + #dev.sigpipe.me certificate issue + #svn.redmine.org certificate error + #www.invoiceplane.com awesome_bot receives error 500, works fine from browser + #notepad.cc not an actual link, mentioned in description + #proxy.donttrustrobots.nl site down issue submitted: https://github.com/swiperproxy/swiperproxy/issues/27 \ No newline at end of file From 5faa77cdefa507bc194083837499ed9022f9abc2 Mon Sep 17 00:00:00 2001 From: nrew225 Date: Tue, 25 Oct 2016 12:41:59 -0700 Subject: [PATCH 3/3] actually add swiper proxy to whitelist --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d298532b..7d5bd9d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ before_install: - gem install awesome_bot script: - node test.js - - awesome_bot README.md --allow-dupe --allow-redirect -w scrollback.io,dev.sigpipe.me,svn.redmine.org,notepad.cc,www.invoiceplane.com + - awesome_bot README.md --allow-dupe --allow-redirect -w scrollback.io,dev.sigpipe.me,svn.redmine.org,notepad.cc,www.invoiceplane.com,proxy.donttrustrobots.nl #Whitelisted Reason #scrollback.io certificate issue #dev.sigpipe.me certificate issue