configuration not being honored
ablyler opened this issue · 7 comments
I'm trying to use a custom configuration via my .codeclimate.yml that is in the root of my repo that contains:
exclude_paths:
- "/build"
- "/doc_generator"
- "/modules"
- "/resource"
- "/tests"
engines:
phpcodesniffer:
enabled: true
config:
- file_extensions: "php"
- standard: ["/code/modules/code-standards/company/ruleset.xml"]
ratings:
paths:
- "**.php"
However, when I look at the running processes while running codeclimate analyze, I see:
4327 ? Ss 0:00 \_ /bin/sh /usr/src/app/bin/codeclimate-phpcodesniffer
4333 ? S 0:00 \_ php /usr/src/app/bin/../engine.php
4334 ? S 0:00 \_ sh -c ./vendor/bin/phpcs --report=json --ignore= --standard=PSR1,PSR2 /code
4335 ? R 0:01 \_ php ./vendor/bin/phpcs --report=json --ignore= --standard=PSR1,PSR2 /code
Also, this might be a hint:
$ codeclimate validate-config
WARNING in engines: unexpected key "config", dropping
Sorry about this! We recently made our config parser more strict and accidentally made it reject this valid key. We'll do our best to get that fixed soon.
Hey!
I just pushed some changes that should resolve this issue. Here's what you need to do:
-
Update the codeclimate CLI. If you're using homebrew on OS X, you can do this with
brew update && brew upgrade codeclimate. -
Update your config file to be the following:
exclude_paths: - "build/**/*" - "doc_generator/**/*" - "modules/**/*" - "resource/**/*" - "tests/**/*" engines: phpcodesniffer: enabled: true config: file_extensions: "php" standard: "/code/modules/code-standards/company/ruleset.xml" ratings: paths: - "**/*.php"
I changed a few things here:
- Your exclude paths were absolute instead of relative. These new globs will exclude all files in those directories and their subdirectories
- I updated the phpcodesniffer config. Our README was actually wrong on this one and I've updated it there as well.
- Applied a similar glob fix to the ratings paths.
-
Re-run
codeclimate analyze. You should have the correct config now.
If this doesn't work for you, let me know and I can help debug more!
@gordondiggs thanks, I think we are getting closer! Is this normal?
2693 ? Ss 0:00 \_ /bin/sh /usr/src/app/bin/codeclimate-phpcodesniffer
2701 ? S 0:00 \_ php /usr/src/app/bin/../engine.php
2702 ? S 0:00 \_ sh -c ./vendor/bin/phpcs --report=json --extensions=php --ignore= --standard=/code/modules/code-standards/company/ruleset.xml /code
2703 ? R 1:41 \_ php ./vendor/bin/phpcs --report=json --extensions=php --ignore= --standard=/code/modules/code-standards/company/ruleset.xml /code
Notice the empty ignore arg. Should that contain the exclude paths?
Also, the output of codeclimate analyze is:
Starting analysis
Running phpcodesniffer: Done!
Analysis complete! Found 0 issues.
But when I run phpcs by hand there are a bunch of outstanding issues.