Skip to content

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

Closed
@devvmh

Description

@devvmh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions