Skip to content

Instantly share code, notes, and snippets.

@snodgrass23
Created November 7, 2012 14:50
Show Gist options
  • Save snodgrass23/4032034 to your computer and use it in GitHub Desktop.
Save snodgrass23/4032034 to your computer and use it in GitHub Desktop.
verifyjs analysis output
var foo = bar
less = more;
function complexFunction(one, two, three, four, five, six) {
if (one) {
}
else if (two) {
var hello;
}
else if (three) {
}
else if (four) {
}
else if (five) {
}
else if (six) {
}
else {
}
return one
}
function simpleFunction(one, two) {
return one = two
}
var nestedFunction = function() {
if (true) {
if (true) {
if (true) {
if (true) {
return true;
}
}
}
}
return false
}
complexFunction.prototype = {
cbFunction: function(one, two, done) {
done(null, one+two)
},
cbFunction2: function(one, two, done) {
done(null, one+two);
},
};
complexFunction.cbFunction(1, 2, function(err, result) {
console.log(err, result)
});
{
functionDetails:
{ complexFunction:
[ { name: 'complexFunction',
param: [ 'one', 'two', 'three', 'four', 'five', 'six' ],
line: 5,
character: 26,
last: 28,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return one',
line: 27,
character: 13,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '7' } ],
simpleFunction:
[ { name: 'simpleFunction',
param: [ 'one', 'two' ],
line: 30,
character: 25,
last: 32,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Did you mean to return a conditional instead of an assignment?',
evidence: ' return one = two',
line: 31,
character: 10,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Did you mean to return a conditional instead of an assignment?' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return one = two',
line: 31,
character: 19,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '1' } ],
nestedFunction:
[ { name: '"nestedFunction"',
param: undefined,
line: 34,
character: 31,
last: 45,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Blocks are nested too deeply (3).',
evidence: ' if (true) {',
line: 37,
character: 17,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Blocks are nested too deeply (3).' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return false',
line: 44,
character: 15,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: '}',
line: 45,
character: 2,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '5' } ],
cbFunction:
[ { name: '"cbFunction"',
param: [ 'one', 'two', 'done' ],
line: 48,
character: 24,
last: 50,
lastcharacter: 4,
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: ' done(null, one+two)',
line: 49,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '1' },
{ name: '"cbFunction"',
param: [ 'err', 'result' ],
line: 58,
character: 43,
last: 60,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: ' console.log(err, result)',
line: 59,
character: 27,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '1' } ],
cbFunction2:
[ { name: '"cbFunction2"',
param: [ 'one', 'two', 'done' ],
line: 52,
character: 25,
last: 54,
lastcharacter: 4,
errors: [],
complexity: '1' } ] },
functions:
[ { name: 'complexFunction',
param: [ 'one', 'two', 'three', 'four', 'five', 'six' ],
line: 5,
character: 26,
last: 28,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return one',
line: 27,
character: 13,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '7' },
{ name: 'simpleFunction',
param: [ 'one', 'two' ],
line: 30,
character: 25,
last: 32,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Did you mean to return a conditional instead of an assignment?',
evidence: ' return one = two',
line: 31,
character: 10,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Did you mean to return a conditional instead of an assignment?' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return one = two',
line: 31,
character: 19,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '1' },
{ name: '"nestedFunction"',
param: undefined,
line: 34,
character: 31,
last: 45,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Blocks are nested too deeply (3).',
evidence: ' if (true) {',
line: 37,
character: 17,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Blocks are nested too deeply (3).' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return false',
line: 44,
character: 15,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: '}',
line: 45,
character: 2,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '5' },
{ name: '"cbFunction"',
param: [ 'one', 'two', 'done' ],
line: 48,
character: 24,
last: 50,
lastcharacter: 4,
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: ' done(null, one+two)',
line: 49,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '1' },
{ name: '"cbFunction2"',
param: [ 'one', 'two', 'done' ],
line: 52,
character: 25,
last: 54,
lastcharacter: 4,
errors: [],
complexity: '1' },
{ name: '"cbFunction"',
param: [ 'err', 'result' ],
line: 58,
character: 43,
last: 60,
lastcharacter: 2,
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: ' console.log(err, result)',
line: 59,
character: 27,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' } ],
complexity: '1' } ],
options:
{ es5: true,
maxcomplexity: 0.5,
white: false,
sub: true,
lastsemic: true,
maxdepth: 2,
indent: 4,
maxerr: 50 },
errors:
[ { id: '(error)',
raw: 'Missing semicolon.',
evidence: 'var foo = bar',
line: 1,
character: 14,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return one',
line: 27,
character: 13,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (7).',
evidence: 'function complexFunction(one, two, three, four, five, six) {',
line: 5,
character: 25,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (7).' },
{ id: '(error)',
raw: 'Did you mean to return a conditional instead of an assignment?',
evidence: ' return one = two',
line: 31,
character: 10,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Did you mean to return a conditional instead of an assignment?' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return one = two',
line: 31,
character: 19,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: 'function simpleFunction(one, two) {',
line: 30,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' },
{ id: '(error)',
raw: 'Blocks are nested too deeply (3).',
evidence: ' if (true) {',
line: 37,
character: 17,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Blocks are nested too deeply (3).' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' return false',
line: 44,
character: 15,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (5).',
evidence: 'var nestedFunction = function() {',
line: 34,
character: 30,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (5).' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: '}',
line: 45,
character: 2,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' done(null, one+two)',
line: 49,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: ' cbFunction: function(one, two, done) {',
line: 48,
character: 23,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: ' cbFunction2: function(one, two, done) {',
line: 52,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' },
{ id: '(error)',
raw: 'Missing semicolon.',
evidence: ' console.log(err, result)',
line: 59,
character: 27,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Missing semicolon.' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: 'complexFunction.cbFunction(1, 2, function(err, result) {',
line: 58,
character: 42,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' } ],
implieds:
[ { name: 'bar', line: [ 1 ] },
{ name: 'less', line: [ 3 ] },
{ name: 'more', line: [ 3 ] },
{ name: 'console', line: [ 59 ] } ],
globals: [ 'foo', 'complexFunction', 'simpleFunction', 'nestedFunction' ],
unused:
[ { name: 'foo', line: 1, character: 8 },
{ name: 'simpleFunction', line: 30, character: 24 },
{ name: 'nestedFunction', line: 34, character: 19 },
{ name: 'hello', line: 10, character: 14 } ],
member: { prototype: 1, cbFunction: 2, cbFunction2: 1, log: 1 },
complexityErrors:
[ { id: '(error)',
raw: 'Cyclomatic complexity is too high per function (7).',
evidence: 'function complexFunction(one, two, three, four, five, six) {',
line: 5,
character: 25,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (7).' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: 'function simpleFunction(one, two) {',
line: 30,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (5).',
evidence: 'var nestedFunction = function() {',
line: 34,
character: 30,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (5).' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: ' cbFunction: function(one, two, done) {',
line: 48,
character: 23,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: ' cbFunction2: function(one, two, done) {',
line: 52,
character: 24,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' },
{ id: '(error)',
raw: 'Cyclomatic complexity is too high per function (1).',
evidence: 'complexFunction.cbFunction(1, 2, function(err, result) {',
line: 58,
character: 42,
scope: '(main)',
a: undefined,
b: undefined,
c: undefined,
d: undefined,
reason: 'Cyclomatic complexity is too high per function (1).' } ],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment