Ignore Duplicated Blocks in files

4,065 views
Skip to first unread message

green blood

unread,
Mar 22, 2018, 12:01:56 PM3/22/18
to SonarQube
Hi we have some classes which contain generated blocks.
Example for swing applications we use the JFORM Designer which generates most of the ui code for us.
Also Equals and Hashcode are generated.
It would be nice if it would be possible to ignore these generated parts inside classes, but it seems you can only ignore whole files.
something like this which is available for issues but not for duplications

//BEGIN GENERATED CODE
  ...SOME CODE...
//END GENERATED CODE

Is there any solution to this? Or is there some workarround?

Florian

Tibor Blenessy

unread,
Mar 22, 2018, 12:21:18 PM3/22/18
to green blood, SonarQube
Hello,

yes, you can ignore issues in blocks defined with a regular expression. Have a look at the documentation here https://docs.sonarqube.org/display/SONAR/Narrowing+the+Focus#NarrowingtheFocus-issues 

Cheers,

Tibor

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/0856eebf-76ff-4512-89a6-92b94ef102a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--

Tibor Blenessy | SonarSource

Language Analyzer Developer

https://sonarsource.com 

Tibor Blenessy

unread,
Mar 22, 2018, 12:24:02 PM3/22/18
to green blood, SonarQube
Sorry, I missed the fact that you talk about duplication. You can only ignore duplication in the whole files by setting sonar.cpd.exclusions property. See here for details https://docs.sonarqube.org/display/SONAR/Analysis+Parameters#AnalysisParameters-Exclusions/Inclusions 

Cheers,

Tibor
Reply all
Reply to author
Forward
0 new messages