codeclimate-duplication icon indicating copy to clipboard operation
codeclimate-duplication copied to clipboard

Feature Request: different duplication mass_threshold by code path

Open radovsky opened this issue 9 years ago • 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!

radovsky avatar Oct 20 '16 19:10 radovsky

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!

dblandin avatar Nov 05 '16 22:11 dblandin

+1 We could really benefit from this!

jars avatar Jan 18 '17 20:01 jars

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 avatar Feb 03 '17 01:02 zenspider

@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

radovsky avatar Feb 05 '17 01:02 radovsky

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

zenspider avatar Jun 14 '17 23:06 zenspider

+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.

sagotsky avatar Apr 02 '18 14:04 sagotsky