Skip to content

Instantly share code, notes, and snippets.

@cflems
Created October 24, 2017 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cflems/6b288504b7a5976f8e9b9adbd7c2a069 to your computer and use it in GitHub Desktop.
Save cflems/6b288504b7a5976f8e9b9adbd7c2a069 to your computer and use it in GitHub Desktop.
Comb for lines that create difficulty reading code.
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