Skip to content
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

Does sonar-groovy detect code duplications? #20

Open
smolnikov opened this issue Nov 5, 2019 · 2 comments
Open

Does sonar-groovy detect code duplications? #20

smolnikov opened this issue Nov 5, 2019 · 2 comments
Labels
question Further information is requested

Comments

@smolnikov
Copy link

I tried to use sonar-groovy to perform code analysis on our Jenkins pipeline lib written with groovy, but seems it doesn't detect the code duplications. Does it?

@SMUnlimited
Copy link

SMUnlimited commented Nov 13, 2019

It does, at least sonar automatically does it with this plugin enabled. Not sure if the groovy plugin itself affects duplications in anyway.

Only problem is the duplication detection is odd with groovy. Sometimes it believes import statements are duplicated between different files which you can't do anything about. So you can only ignore the file from duplicates or increase the quality gate thresholds.

@smolnikov
Copy link
Author

@SMUnlimited I'm not sure, but seems https://github.com/Inform-Software/sonar-groovy/blob/master/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/foundation/GroovyHighlighterAndTokenizer.java is responsible for defining what is code duplication and what is not. But I'm definitely not an expert in groovy and sonar. The only thing I see is that sonar is reporting zero duplications even if I copy-paste 3-5 lines of code from one file to another.

@TobiX TobiX added the question Further information is requested label May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants