codeclimate/codeclimate-duplication

Allow setting separate language specific mass thresholds for identical and similar code

rdimartino opened this issue · 8 comments

I can set separate check mass thresholds with

checks:
  identical-code:
    config:
      threshold: 25
  similar-code:
    config:
      threshold: 50

but those aren't language specific.

I can set a language-specific mass threshold with

plugins:
  duplication:
    config:
      languages:
        javascript:
          mass_threshold: 50

but that sets the threshold for both identical and similar code.

I want to be able to do something like

plugins:
  duplication:
    config:
      languages:
        javascript:
          identical-code:
            mass_threshold: 25
          similar-code:
            mass_threshold: 50

👍

Hi @kevinleturc and @rdimartino - thanks for the suggestion. Although I don't have an ETA, this is something that we're looking at adding.

Can you tell me a little bit more about your use case?

  • what languages are you using
  • if you're getting false positives for a specific language, are you using any frameworks or other standard conventions that have boilerplate similar/identical code?

@efueger We're using a Rails backend with a React frontend. We were getting some false positives when using some of our more template-like React components that have a little bit more boilerplate but can't really be abstracted further.

As a work around for this we currently doing something like:

checks:
  identical-code:
    config:
      threshold: 35
...
plugins:
  duplication:
    enabled: true
    config:
      languages:
        javascript:
          mass_threshold: 75

but this is obviously not ideal.

We're in the same boat, Rails backend + React frontend. In particular React has a lot of structure repetition (considered best practice afaik) like PropTypes (see #89).

Same for us. Really want to decrease identical-code threshold only for the Javascript, as we use Ember. Works fine for the backend part on Rails.

+1 for this. Our use-case is an android project that is partially java and partially kotlin. Thanks!

+1, we have a similar situation where frontend technologies should have a different threshold than backend. Is this still being considered?

+1 it'd be very useful. We need to separate frontend from backend as well.
I wonder if there's a way to do so, maybe create separate .codeclimate.yml config files in separate folders?