exclude_paths for this specific engine not working
Mange opened this issue · 2 comments
Hi!
I'm trying to ignore the duplication engine in according to certain patterns, but no matter which way I try it the files are not ignored.
As an example, I have duplication in app/graph/core_api/mutations/image_update.rb.
Neither of these configs work:
[EDIT: Typo in code examples fixed]
engines:
duplication:
enabled: true
config:
languages:
ruby:
exclude_paths:
- "app/graph/**/*.rb"
- "app/graph/core_api/mutations/image_update.rb"engines:
duplication:
enabled: true
config:
exclude_paths:
- "app/graph/**/*"
- "app/graph/core_api/mutations/image_update.rb"
languages:
- rubyThe only way I can get it to ignore this file is to add it to the top-level exclude_paths:
engines:
duplication:
enabled: true
config:
languages:
- ruby
exclude_paths:
- "app/graph/**/*.rb"However, this directory will then be ignored in all other engines which is not what I want.
I tried finding the code that deals with exclude_paths but came up empty. Is it dealing with this at all currently?
I run this command to test it:
docker run \
--interactive --tty --rm \
--env CODECLIMATE_CODE="$PWD" \
--volume "$PWD":/code \
--volume /var/run/docker.sock:/var/run/docker.sock \
--volume /tmp/cc:/tmp/cc \
codeclimate/codeclimate analyze -e duplication
I only run this locally because the first config example is not working in hosted Codeclimate. Is the local and remote version working differently here?
Anything else I can do to help you debug this?
@Mange thanks for opening this issue! A couple of things:
- the languages key should be nested under the config key to work properly:
duplication:
enabled: true
config:
languages:
- ruby
- javascript
- python
- php
exclude_paths:
- "big_file.rb"
otherwise I'd expect an error like
error: (CC::Analyzer::Engine::EngineFailure) engine duplication:stable failed with status 1 and stderr
Config Error: Unable to run the duplication engine without any languages enabled.
For the engine-specific exclude paths, I think
engines:
duplication:
enabled: true
exclude_paths:
- "app/graph/**/*"
- "app/graph/core_api/mutations/image_update.rb"
config:
languages:
- ruby
looks good. Can you try that and let me know how it goes? Also, make sure you're running the latest version of the CLI: docker pull codeclimate/codeclimate
the languages key should be nested under the config key
I'm sorry. That was a transcription problem when typing out the contents here. It's already nested correctly.
I've updated the original post for future readers.
I think [this configuration] looks good
Indeed! That worked. Thank you!