Created
October 24, 2017 18:33
-
-
Save cflems/6b288504b7a5976f8e9b9adbd7c2a069 to your computer and use it in GitHub Desktop.
Comb for lines that create difficulty reading code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require('readline'); | |
const colors = require('colors'); | |
const rl = readline.createInterface({ | |
input: process.stdin, | |
}); | |
let line = 1, warn = 0; | |
rl.on('line', (ln) => { | |
if (ln.length > 80) console.warn(('#'+(++warn)+' ').red.bold | |
+('Line '+line+': ').yellow | |
+'Character limit exceeded (' | |
+ln.length+' chars).'); | |
line++; | |
}); | |
rl.on('close', () => { | |
let str = warn+' warnings generated.'; | |
if (warn > 0) console.warn(str.yellow.bold); | |
else console.log(str.green.bold); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment