Only report if there are 3 occurrences of the code?
devvmh opened this issue · 5 comments
I've been fiddling with the mass settings on the duplication engine, and it's pretty good, but I find that often I have legitimate reasons for writing code twice; namely, it would be needlessly obfuscating code to refactor a given pair of functions.
Is there a way to configure the "count threshold"? Currently this seems to be hard coded at 2: if code happens twice, it is reported. I'd like to be able to configure something like this:
duplication:
enabled: true
config:
languages:
ruby:
mass_threshold: 10
count_threshold: 3
This would emulate the "rule of three" in Ruby while being extra-strict about code mass.
If this is interesting to the core team, I could potentially even write a pull request.
Is there documentation somewhere on how to run a custom engine? I've got the CLI running but I haven't found the docker images yet. I'm also not really confident in my ability to change/debug the code running in docker
edit: i guess http://blog.codeclimate.com/blog/2015/07/07/build-your-own-codeclimate-engine/ is what there is
Hey! That blog post is a good place to start. I actually just explained to another contributor how to test local engines or engines updates here.
I'd check that out first and let us know if you have any more questions.
Additionally, if you join our Devoloper Program, you'll receive an invite to our Code Climate Community Slack organization where there are many, including staff who can help out.
Thanks! I was able to figure it out using the blog post (see #142)
If I write another PR I'll consider the developmer program, but really this is the only feature I'm looking to get right now. On a related note - if the PR is merged, will I be able to use this feature by default on codeclimate.com? Or will there be some way to reference the development version in my .codeclimate.yml?
Thanks for helping out
Yep, that's right. Any PR merged into master will be available on the stable channel of the engine via the CLI or codeclimate.com.