common-java:DuplicatedBlocks not usable in sonar.issue.ignore.multicriteria

4,908 views
Skip to first unread message

klei...@gmail.com

unread,
Jan 27, 2016, 12:29:38 PM1/27/16
to SonarQube
Hello,


I have tried to ignore the common-java:DuplicatedBlocks on specific packages, where we simply cannot avoid duplicates. 

However configuring it in the project for "Ignore issues on multiple criteria" with the rule key "common-java:DuplicatedBlocks" and a pattern like "**/models/**" did not work.

Using some squid key works fine, but this message is not from the Sonarqube rule repository. Is this some known bug/feature? Is there a way around it?

Thanks in advance

/lain

Julien HENRY

unread,
Jan 27, 2016, 2:44:40 PM1/27/16
to SonarQube, klei...@gmail.com
Hi Lain,

This is indeed a known limitation:

Feel free to vote for this ticket.

++

Julien

Michel

unread,
Sep 27, 2016, 1:53:12 AM9/27/16
to SonarQube, klei...@gmail.com

Hello,

Coming back to this quite old issue : the JIRA ticket below says it's been fixed in v5.6.

I recently installed 6.0 and I see that I still can't ignore this rule with multi criteria.

Could you check if this really has been fixed in v6.0 as well and if not, when can I get it fixed in v6 ?

Thanks

Tony

unread,
May 17, 2017, 12:42:04 PM5/17/17
to SonarQube
Hi All,

Do we know if this issue was indeed fixed in v6.0? I have v6.2 and I'm having the exact issue.

Thanks!
TonyD...

Michael Piefel

unread,
Jun 7, 2017, 7:46:23 AM6/7/17
to SonarQube, ras...@gmail.com


Am Mittwoch, 17. Mai 2017 18:42:04 UTC+2 schrieb Tony:
Hi All,

Do we know if this issue was indeed fixed in v6.0? I have v6.2 and I'm having the exact issue.

Thanks!
TonyD...


I can confirm the issue for today and version 6.3 

Michael Piefel

unread,
Jun 28, 2017, 5:59:46 AM6/28/17
to SonarQube, ras...@gmail.com


Am Mittwoch, 7. Juni 2017 13:46:23 UTC+2 schrieb Michael Piefel:

I can confirm the issue for today and version 6.3 


I can confirm the issue for today and version 6.4

G. Ann Campbell

unread,
Jun 28, 2017, 9:47:43 AM6/28/17
to SonarQube, ras...@gmail.com
Hi,

Thanks for bumping the thread. I just tested with 6.4, and this worked for me.

Note that the ticket cited at the beginning of the thread limits to two cases the circumstances under which this will work:

* Ignore Issues on Multiple Criteria - specify combination of rule key pattern and file path pattern to exclude. I.e. "Ignore these issues on these files"
* Restrict Scope of Coding Rules - specify combination of rule key pattern and file path pattern to include. I.e. "Ignore everything but these issues on these files"

How are you specifying your exclusions?


Ann

Michael Piefel

unread,
Jul 4, 2017, 4:47:53 AM7/4/17
to SonarQube, ras...@gmail.com


Am Mittwoch, 28. Juni 2017 15:47:43 UTC+2 schrieb G. Ann Campbell:
Hi,

Thanks for bumping the thread. I just tested with 6.4, and this worked for me.

Note that the ticket cited at the beginning of the thread limits to two cases the circumstances under which this will work:

* Ignore Issues on Multiple Criteria - specify combination of rule key pattern and file path pattern to exclude. I.e. "Ignore these issues on these files"
* Restrict Scope of Coding Rules - specify combination of rule key pattern and file path pattern to include. I.e. "Ignore everything but these issues on these files"

How are you specifying your exclusions?

Hi Ann,

I hadn’t thoroughly read the ticket mentioned in the second message, but more the OP and the thread’s heading. Anyway, an excerpt from my POM is:

<sonar.issue.ignore.multicriteria>a,b,c,d,e,f,g,h,i,j</sonar.issue.ignore.multicriteria>
<!-- … -->
<!-- Fields without access – there are dozens of false positives, it’s all Lombok -->
<sonar.issue.ignore.multicriteria.g.ruleKey>squid:S1450</sonar.issue.ignore.multicriteria.g.ruleKey>
<sonar.issue.ignore.multicriteria.g.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.g.resourceKey>
<!-- … -->
<!-- Source files should not have any duplicated blocks – configuration in code (‘Sometimes the solution is worse than the problem’)-->
<sonar.issue.ignore.multicriteria.j.ruleKey>common-java:DuplicatedBlocks</sonar.issue.ignore.multicriteria.j.ruleKey>
<sonar.issue.ignore.multicriteria.j.resourceKey>**/mailers/*.java</sonar.issue.ignore.multicriteria.j.resourceKey>


Rule exclusion g seems to work, while j does not.

Regards,
   Michael


G. Ann Campbell

unread,
Jul 4, 2017, 5:19:36 AM7/4/17
to Michael Piefel, SonarQube, ras...@gmail.com
Hi Michael,

Could you try specifying this exclusion through the UI? Clearly you've worked out how to get file-based multi-criteria exclusions right, but we don't document this ability because it's tricky. So just to eliminate that possibility, I'd try it through the UI.


Ann



---
G. Ann Campbell | SonarSource
Product Manager
@GAnnCampbell

--
You received this message because you are subscribed to a topic in the Google Groups "SonarQube" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sonarqube/Y3tMzGdiRbg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sonarqube+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/d521aa6a-fe0a-4001-ba96-d261aa71c9da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael Piefel

unread,
Jul 4, 2017, 10:28:48 AM7/4/17
to SonarQube, michael...@welldoo.com, ras...@gmail.com


Am Dienstag, 4. Juli 2017 11:19:36 UTC+2 schrieb G. Ann Campbell:
Hi Michael,

Could you try specifying this exclusion through the UI? Clearly you've worked out how to get file-based multi-criteria exclusions right, but we don't document this ability because it's tricky. So just to eliminate that possibility, I'd try it through the UI.


Hi Ann, as weird as seems to me – yes, it works when specified through the UI. So that’s one way to fix the problem at least for develop and master branch. (As usual, my insistence on specifying this in code relies to automatically created projects from Git feature branches by Bamboo continuous integration builds.)

– Michael

Julien HENRY

unread,
Jul 7, 2017, 1:33:52 PM7/7/17
to SonarQube, michael...@welldoo.com, ras...@gmail.com
Hi,

You are affected by this issue:

++

Julien
Reply all
Reply to author
Forward
0 new messages