-
Notifications
You must be signed in to change notification settings - Fork 97
SONARPY-663 Rule S5780: Expressions creating dictionaries should not … #712
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
Conversation
bd86b13 to
b8d93db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quadratic runtime of the all-vs-all comparison seems risky - maybe we could exclude the dangerous cases to make sure the analyzer doesn't freeze suddenly. Several other potential sources for both false negatives and false positives exist, but those are, admittedly, both difficult to fix and not too important. I've pointed out where such FNs/FPs are possible, but I don't necessarily expect any changes there - some refinements would be nice to have, but only if you think that some of them would be easily fixed.
python-checks/src/main/java/org/sonar/python/checks/DictionaryDuplicateKeyCheck.java
Outdated
Show resolved
Hide resolved
python-checks/src/main/java/org/sonar/python/checks/DictionaryDuplicateKeyCheck.java
Outdated
Show resolved
Hide resolved
python-checks/src/main/java/org/sonar/python/checks/DictionaryDuplicateKeyCheck.java
Outdated
Show resolved
Hide resolved
python-checks/src/main/java/org/sonar/python/checks/DictionaryDuplicateKeyCheck.java
Outdated
Show resolved
Hide resolved
python-checks/src/test/resources/checks/dictionaryDuplicateKey.py
Outdated
Show resolved
Hide resolved
python-checks/src/test/resources/checks/dictionaryDuplicateKey.py
Outdated
Show resolved
Hide resolved
20404f7 to
6c7fc94
Compare
…have duplicate keys
6c7fc94 to
7c4ad6f
Compare
7c4ad6f to
af74d2b
Compare
|
Kudos, SonarQube Quality Gate passed! |
|
Nice intuition on the 100 threshold :) I guess the worst case scenario is actually the most common scenario (granted not reflected by the unit test which would terminate early) since duplicate keys are not desirable, so I'm not sure which comment should be changed and how? |
GitOrigin-RevId: 8c4f92335925cf1d2ab2be94698dde37995b78c5
…have duplicate keys