Closed anthonyhastings closed 5 years ago
Ignore this. Apologies. I've read the newer documentation and see that there's an exclude_patterns
property at the top level of a plugin config. I think where I'd got confused was that I was placing exclude_patterns
down in config.languages.javascript
.
@anthonyhastings Could you please provide a link (to documentation or code) with exclude_patterns
option?
I can't find it 😞
I still can't get this to work. Anybody got a working example?
Solution:
plugins:
duplication:
enabled: true
exclude_patterns:
- 'spec/**/*.rb'
thanks, I think I figured it out eventually. But how come this is not on this page? https://docs.codeclimate.com/docs/duplication-concept I have tried many things with checks: similar-code
but didn't try plugins: duplication
. it's so counter intuitive!
I've seen previous issues talking about this issue; https://github.com/codeclimate/codeclimate-duplication/issues/115 https://github.com/codeclimate/codeclimate-duplication/issues/113
One particular answer (https://github.com/codeclimate/codeclimate-duplication/issues/113#issuecomment-203964518) mentions going to a documentation page but it doesn't seem to have relevant information anymore. It contains a hash / fragment in the URL (
#section-exclude-paths-for-specific-engines
) that doesn't link to anywhere on the page.It also gives this code snippet, which I believe is old as the
codeclimate validate-config
CLI command tells me theengines
key is unrecognised.The current documentation mentions custom file name patterns but it doesn't mention how this could be used to, for example, target all JS files that don't have a
spec
suffix, e.g.Any help would be appreciated. I've tried
engines
, and then using various connotations of regexes/globs withinpatterns.duplication.config.languages.javascript.patterns
. If this is indeed the right approach, then I'm assuming the pattern needs to be a single magic pattern that does everything in one go, as from examining the code I see that if a file name matches any single pattern in the array, it's included: https://github.com/codeclimate/codeclimate-duplication/blob/0646b13edc0e5b5f28512cf68a5e3ca500ca151f/lib/cc/engine/analyzers/file_list.rb#L37-L45