Skip to content

feature: allowed repetitions#10

Merged
dannote merged 5 commits into
elixir-vibe:masterfrom
neerfri:add-allowed-repetitions
May 2, 2026
Merged

feature: allowed repetitions#10
dannote merged 5 commits into
elixir-vibe:masterfrom
neerfri:add-allowed-repetitions

Conversation

@neerfri

@neerfri neerfri commented May 1, 2026

Copy link
Copy Markdown
Contributor

@dannote Thanks for merging the previous PR so quickly and releasing the version.
In the spirit of quick iteration this PR adds a feature that I wanted to see what you think of before I complete the implementation with proper mix task args and config file support.

Summary

It's often advised to wait with extracting repeating code until the 3rd or 4th time you repeat it. Otherwise you may be drying too early and not giving the code in each call site time to mature.
This feature adds a config flag allowed_repetitions that will filter clones that don't have at least that many fragments.

Open Tasks

  • support flag in config file
  • support flag in mix tasks
  • add flag to README

@dannote

dannote commented May 1, 2026

Copy link
Copy Markdown
Collaborator

Thanks, I like the direction — I can see this being useful for teams that only want to act once duplication appears in several places.

One naming concern before this grows CLI/docs support: allowed_repetitions overlaps conceptually with max_clones — both read like duplication budgets, but they operate at different levels.

Would you be open to renaming this to min_occurrences?

That would make the interaction clearer:

  • min_occurrences: 3 → only report clone groups appearing in 3+ locations
  • max_clones: 10 → fail CI if more than 10 reportable clone groups remain

With that naming, the default should be 2 to preserve current behavior.

I’d also like the final version to include config type/validation, Mix task flag support, and README docs that clarify max_clones applies after report filters like min_occurrences.

@neerfri

neerfri commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

I also didn't like allowed_repetitions I was prying you'd come up with a better name. Prayer answered!

I'm working to finalize this

@neerfri

neerfri commented May 1, 2026

Copy link
Copy Markdown
Contributor Author

I believe it's done

@dannote dannote merged commit 308c2f7 into elixir-vibe:master May 2, 2026
2 checks passed
@dannote

dannote commented May 2, 2026

Copy link
Copy Markdown
Collaborator

Thanks @neerfri — merged!

@neerfri neerfri deleted the add-allowed-repetitions branch May 2, 2026 09:49
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 this pull request may close these issues.

2 participants