Skip to content

Only report if there are 3 occurrences of the code? #131

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

Closed
devvmh opened this issue Sep 29, 2016 · 5 comments · Fixed by #142
Closed

Only report if there are 3 occurrences of the code? #131

devvmh opened this issue Sep 29, 2016 · 5 comments · Fixed by #142

Comments

@devvmh
Copy link
Contributor

devvmh commented Sep 29, 2016

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.

@dblandin
Copy link
Contributor

Hey @devvmh,

I think that's a great idea and would happily review a PR!

@devvmh
Copy link
Contributor Author

devvmh commented Oct 18, 2016

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

@dblandin
Copy link
Contributor

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.

@devvmh
Copy link
Contributor Author

devvmh commented Oct 18, 2016

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

@dblandin
Copy link
Contributor

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.

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

Successfully merging a pull request may close this issue.

2 participants