codeclimate/codeclimate-duplication

Feature Request: different duplication mass_threshold by code path

radovsky opened this issue · 6 comments

I have a lot of pages in my app (in a specific directory) that are using a DSL which requires some duplication. I'd like to be able to set a higher threshold for similar/identical code for files in this directory, without raising the threshold for the rest of the codebase.

Thanks!

Sounds like a nice feature to me! Not sure when we would have the opportunity to implement this internally but I'll add a couple GH labels to encourage a community contribution.

Thanks!

jars commented

+1 We could really benefit from this!

I'm currently thinking about adding the ability to have a different mass threshold per node type (iter, call, lasgn, etc)... not by path. Would that address what you want, or do you think path is actually important in this case?

ETA: PS, iter is a call w/ a block, so what most "DSL"s would be using.

@zenspider it seems like code path might actually matter for the use case I had in mind, at least if your solution would not discriminate between different types of iteration loops within a node type. Since writing the original post, I left the organization which owns all the aforementioned code, so at the moment it's difficult for me to check. cc @blimmer

I've gone about this completely differently by adding pattern matching and filtering. See #190 for my proposed solution to this.

+1. My use case is for tests. I don't expect tests to be DRY. I want them to be dumb and simple. It would be really nice to have a different similarity threshold for test/ than the rest of the app.