Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider emitting warnings on invalid config options #818

Open
kostajh opened this issue Mar 12, 2018 · 0 comments
Open

Consider emitting warnings on invalid config options #818

kostajh opened this issue Mar 12, 2018 · 0 comments
Assignees

Comments

@kostajh
Copy link

@kostajh kostajh commented Mar 12, 2018

Consider the following configuration:

version: "2"
plugins:
  eslint:
    enabled: true
    channel: "eslint-4"
    config:
      config: ./.eslintrc.js
      extensions:
        - .js

This is correct, and uses ESLint 4.

version: "2"
plugins:
  eslint:
    enabled: true
    config:
      config: ./.eslintrc.js
      channel: "eslint-4"
      extensions:
        - .js

This is incorrect, but no warnings are given by codeclimate analyze -e eslint when this configuration is used. If I use the incorrect configuration, I see:

16:54 $ CODECLIMATE_DEBUG=1 codeclimate analyze -e eslint /path/to/file.js
Starting analysis
I, [2018-03-12T20:55:14.545541 #1]  INFO -- : starting engine eslint
D, [2018-03-12T20:55:14.566194 #1] DEBUG -- : /config.json content: {"enabled"=>true, "config"=>{"config"=>"./.eslintrc.js", "channel"=>"eslint-4", "extensions"=>[".js"]}, "channel"=>"stable", "include_paths"=>["/path/to/file.js"], "debug"=>"1"}
D, [2018-03-12T20:55:14.582168 #1] DEBUG -- : docker run: ["docker", "run", "--name", "cc-engines-eslint-stable-6e3962ef-06db-4b4f-8488-f505dbe10c5b", "--cap-drop", "all", "--label", "com.codeclimate.label=24bcce10-3cf7-4329-8c0f-ce9f5f86b5a4", "--log-driver", "none", "--memory", "1024000000", "--memory-swap", "-1", "--net", "none", "--rm", "--volume", "/Users/kostajh/src/project:/code:ro", "--volume", "/tmp/cc/a686e6d6-d32b-4ab7-b1b4-568d1852f8e2:/config.json:ro", "--user", "9000:9000", "codeclimate/codeclimate-eslint"]
D, [2018-03-12T20:55:15.421642 #1] DEBUG -- : engine stderr: ESLint is running with the default parser.
D, [2018-03-12T20:55:15.439805 #1] DEBUG -- : engine stderr:
I, [2018-03-12T20:55:16.000033 #1]  INFO -- : finished engine eslint

From a superficial view, it appears that eslint-4 is used but in fact it's not. To debug, I had to construct a docker run command from the output above, then look at the Dockerfile entrypoint.sh file, then see that eslint was on version 3.

Using the correct config, the only visible difference is that codeclimate/codeclimate-eslint:eslint-4 is now used as the image; now that I know to look for this, it's obvious, but before it wasn't.

Anyway, in short, it would be helpful to warn users about invalid config options to save time on debugging. Thanks for considering!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.