-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React's propTypes often marked as duplicates #89
Comments
@jdelStrother Thank you for the feedback! We are working to improve our Duplication engine's analysis of JavaScript and make results more savvy. I'm going to tag this issue as In the meantime, one workaround might be to to experiment with upping the
Our default for JavaScript is 40. Increasing the threshold should make the detection of duplication less sensitive. |
Very similar situation occurs when checking Ember imports:
is a duplication of something like this ie.:
This affects overall score a lot :( |
@netes @jdelStrother Sorry for the frustration here. Right now the duplication algorithm effectively compares syntax nodes based on both what kind of expression they represent, as well as the contents of those expressions. When the kinds of the expressions are the same, but the contents vary (which looks to be the case here), the engine considers that "similar" duplication to distinguish it from "identical" duplication. The detection of "similar" duplication like your case is one that, while it can turn up helpful results in many cases, is unfortunately also prone to these kinds of false-positives that are easy to distinguish as a human but not easy to make a decision about within an algorithm. We are continuing to investigate ways of improving the algorithm for these kinds of cases, but need to be careful that in avoiding false-positives we don't swing too far and stop returning useful instances of similar code. So for the time being we don't consider this behavior a bug since this is the expected behavior of Flay, the underlying tool this engine uses for detecting duplication. There are several workarounds available to you in the meantime:
@netes If you use any of these workarounds to exclude these issues, they will no longer affect your repo's grade. |
See #190 for my proposed solution to this. |
This ticket is a bit stale, I just want to note that the work from #190 is now part of the We are not counting |
Sorry to bring back a stale issue but I'm running into this with constructor(props){
super(props) being marked as duplicate and I can't fathom how to filter this out. |
It looks like assignments were recently made to team members, but this is something that makes the code duplication rule very difficult to manage in React projects. Really excited to see this feature come in. |
To those who landed here and saw @wfleming's suggestion about configuring filter patterns but didn't want to do the legwork of running
The following configuration works:
|
That configuration is not working for me.
This also works for me:
I changed it based on this quote:
from: https://github.com/codeclimate/codeclimate-duplication |
But is still catching repetitions on things like
I set |
Facing similar kind of issue, in React js as well. |
Hi - a common source of false-positives in our CC duplication results comes from React's propType structures. For example:
is a 'duplicate' of:
Can the engine be improved to avoid this, or is there anything we can do in our codebase that would help? Excluding each fingerprint on a case-by-case basis is getting tiresome.
The text was updated successfully, but these errors were encountered: