jtheriault / code-copter

A pluggable framework for analyzing code and reporting problems.
ISC License
1 stars 0 forks source link

throw new Error(`Expected to find JSCS configuration ${jscsrcPath} #1

Closed KeithPepin closed 8 years ago

KeithPepin commented 8 years ago

Joe,

Not sure if this is configuration, or a bug. Maybe we can sync up to confirm, but after including the latest code-copter into my project I'm getting the following (see below).

Keith

> node-hapi-boilerplate@0.0.2 test /home/kpepin/WebstormProjects/node-hapi-boilerplate
> NODE_ENV=test JASMINE_CONFIG_PATH=jasmine.json istanbul cover `which jasmine`

/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/analyzers/jscs.js:19
            throw new Error(`Expected to find JSCS configuration ${jscsrcPath}
                            ^
=============================================================================
Writing coverage object [/home/kpepin/WebstormProjects/node-hapi-boilerplate/coverage/coverage.json]
Writing coverage reports at [/home/kpepin/WebstormProjects/node-hapi-boilerplate/coverage]
=============================================================================

=============================== Coverage summary ===============================
Statements   : 25% ( 1/4 )
Branches     : 100% ( 0/0 )
Functions    : 100% ( 0/0 )
Lines        : 25% ( 1/4 )
================================================================================
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Object.Module._extensions.(anonymous function) [as .js] (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/istanbul/lib/hook.js:109:37)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/analyzers/index.js:3:11)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0
jtheriault commented 8 years ago

It looks like your environment is running into the ES6 syntax of code-copter and having none of it. I'm still trying to work out what my responsibility as a module publisher is in terms of providing compatability downstream and I'm open to thoughts.

On your end, you could handle it either by bringing in a more recent version of node (using nvm to maintain multiple versions if necessary) or by using babel.

I'll leave this open to give you the opportunity (although not the obligation ;) to make the case that it is my responsibility.

KeithPepin commented 8 years ago

Interesting. I've got nvm set up to use the latest stable build, but am not using babel personally. If babel is a requirement for the node module to work, then based on my settings, shouldn't code-copter ignore the ES6 syntax since it is part of node_modules?

jtheriault commented 8 years ago

Babel is not a requirement of the module itself. I was suggesting that as a possible solution for getting it to run in an es5 environment.

Can you confirm that nvm is managing your node executable by passing node the --version flag to confirm that it is the latest stable version?

KeithPepin commented 8 years ago

Good call. Turns out it wasn't. I reinstalled nvm and it is now managing things correctly, and my version is v4.2.1 (latest) now. Code copter now runs without immediately erroring (success!). Alas, we're not in the clear yet:

Failures:
1) Code quality spec/quality_spec.js should meet source quality standards
  Message:
    line 11:    '{a}' is not defined.
  Stack:
    Error: line 11:     '{a}' is not defined.
        at Object.shouldPassSourceMatchers (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/code-copter.js:39:54)

2) Code quality source/index_spec.js should meet source quality standards
  Message:
    line 3:     '{a}' is not defined.
    line 4:     '{a}' is not defined.
    line 5:     '{a}' is not defined.
    line 8:     '{a}' is not defined.
    line 11:    '{a}' is not defined.
    line 12:    '{a}' is not defined.
    line 9:     '{a}' is defined but never used.
  Stack:
    Error: line 3:      '{a}' is not defined.
    line 4:     '{a}' is not defined.
    line 5:     '{a}' is not defined.
    line 8:     '{a}' is not defined.
    line 11:    '{a}' is not defined.
    line 12:    '{a}' is not defined.
    line 9:     '{a}' is defined but never used.
        at Object.shouldPassSourceMatchers (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/code-copter.js:39:54)

3) Code quality coverage/lcov-report/prettify.js should meet source quality standards
  Message:
    line 1:     Operator = should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Anonymous functions need to be named
    line 1:     One space required after "function" keyword
    line 1:     One (or more) spaces required before opening brace for block expressions
    line 1:     Missing newline after opening curly brace
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Invalid quote mark found
    line 1:     Operator = should not stick to following expression
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
  Stack:
    Error: line 1:      Operator = should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Anonymous functions need to be named
    line 1:     One space required after "function" keyword
    line 1:     One (or more) spaces required before opening brace for block expressions
    line 1:     Missing newline after opening curly brace
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Invalid quote mark found
    line 1:     Operator = should not stick to following expression
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
    line 1:     Operator undefined should not stick to preceding expression
    line 1:     Operator = should not stick to following expression
    line 1:     Invalid quote mark found
    line 1:     Var declarations should be joined
        at Object.shouldPassSourceMatchers (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/code-copter.js:39:54)
  Message:
    TypeError: Cannot read property 'line' of null
  Stack:
    TypeError: Cannot read property 'line' of null
        at /home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/analyzers/jshint.js:44:48
        at Array.map (native)
        at compare (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/analyzers/jshint.js:44:22)
        at Object.shouldPassSourceMatchers (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/code-copter.js:39:54)

4) Code quality coverage/lcov-report/sorter.js should meet source quality standards
  Message:
    line 1:     Anonymous functions need to be named
    line 2:     Invalid quote mark found
    line 5:     Object keys must be in ascending order
    line 9:     Comments must start with an uppercase letter, unless it is part of a textblock
    line 10:    Line comments must be preceded with a blank line
    line 11:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 12:    Line comments must be preceded with a blank line
    line 13:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 14:    Line comments must be preceded with a blank line
    line 15:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 18:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 38:    Missing newline after block
    line 40:    Line comments must be preceded with a blank line
    line 41:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 49:    ; and for should have at least 2 line(s) between them
    line 56:    Missing newline after block
    line 58:    Missing newline after block
    line 60:    Line comments must be preceded with a blank line
    line 61:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 69:    Line comments must be preceded with a blank line
    line 70:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 73:    Use a function declaration instead
    line 73:    Anonymous functions need to be named
    line 77:    Missing newline after block
    line 85:    Use a function declaration instead
    line 85:    Anonymous functions need to be named
    line 100:   Line comments must be preceded with a blank line
    line 101:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 108:   Line comments must be preceded with a blank line
    line 109:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 112:   Line comments must be preceded with a blank line
    line 113:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 117:   Use a function declaration instead
    line 120:   Anonymous functions need to be named
    line 125:   Missing newline after block
    line 132:   ; and for should have at least 2 line(s) between them
    line 132:   Missing newline after block
    line 133:   Operator = should not stick to following expression
    line 133:   Illegal space before semicolon
    line 138:   } and else should be on different lines
    line 143:   Line comments must be preceded with a blank line
    line 144:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 145:   Anonymous functions need to be named
    line 148:   Missing newline after block
  Stack:
    Error: line 1:      Anonymous functions need to be named
    line 2:     Invalid quote mark found
    line 5:     Object keys must be in ascending order
    line 9:     Comments must start with an uppercase letter, unless it is part of a textblock
    line 10:    Line comments must be preceded with a blank line
    line 11:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 12:    Line comments must be preceded with a blank line
    line 13:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 14:    Line comments must be preceded with a blank line
    line 15:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 18:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 38:    Missing newline after block
    line 40:    Line comments must be preceded with a blank line
    line 41:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 49:    ; and for should have at least 2 line(s) between them
    line 56:    Missing newline after block
    line 58:    Missing newline after block
    line 60:    Line comments must be preceded with a blank line
    line 61:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 69:    Line comments must be preceded with a blank line
    line 70:    Comments must start with an uppercase letter, unless it is part of a textblock
    line 73:    Use a function declaration instead
    line 73:    Anonymous functions need to be named
    line 77:    Missing newline after block
    line 85:    Use a function declaration instead
    line 85:    Anonymous functions need to be named
    line 100:   Line comments must be preceded with a blank line
    line 101:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 108:   Line comments must be preceded with a blank line
    line 109:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 112:   Line comments must be preceded with a blank line
    line 113:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 117:   Use a function declaration instead
    line 120:   Anonymous functions need to be named
    line 125:   Missing newline after block
    line 132:   ; and for should have at least 2 line(s) between them
    line 132:   Missing newline after block
    line 133:   Operator = should not stick to following expression
    line 133:   Illegal space before semicolon
    line 138:   } and else should be on different lines
    line 143:   Line comments must be preceded with a blank line
    line 144:   Comments must start with an uppercase letter, unless it is part of a textblock
    line 145:   Anonymous functions need to be named
    line 148:   Missing newline after block
        at Object.shouldPassSourceMatchers (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/code-copter.js:39:54)
  Message:
    line 2:     Strings must use singlequote.
    line 154:   Missing "use strict" statement.
  Stack:
    Error: line 2:      Strings must use singlequote.
    line 154:   Missing "use strict" statement.
        at Object.shouldPassSourceMatchers (/home/kpepin/WebstormProjects/node-hapi-boilerplate/node_modules/code-copter/src/code-copter.js:39:54)

6 specs, 4 failures
Finished in 1.186 seconds
jtheriault commented 8 years ago

I just published v1.4 which makes it possible to specifiy the files/folders to exclude. While I'd like to say that would help, the slightness of the change required leads me to think that won't resolve the issue either.

I don't suppose you'd try though?

KeithPepin commented 8 years ago

Of course I will -- tomorrow. :)

KeithPepin commented 8 years ago

The new additions worked great. I was able to specify different directories not to include in the test, and worked like a charm. Well done sir!

jtheriault commented 8 years ago

Awesome! Woo hoo! First issue closed!