Too many duplication references on file .. for block .. Keep only the first 100 references

4,670 views
Skip to first unread message

Jean-Pierre FAYOLLE

unread,
Dec 2, 2015, 12:54:02 PM12/2/15
to SonarQube
Hello,

Analyzing Cobol (for a post on my blog), I have a lot of messages: "Too many duplication references on file .. for block .. Keep only the first 100 references."
Is there any way (property?) to change this so that I can have all references for each file?

I could only find "sonar.cpd.${language}.minimumTokens" and I think this property is not related with what I want to do.

Do not hesitate to ask for any precision.
Best regards.

Jean-Pierre FAYOLLE
www.qualilogy.com

Julien HENRY

unread,
Dec 7, 2015, 3:33:52 AM12/7/15
to SonarQube
Hi Jean-Pierre,

Currently this limit is hard coded since the UI is not designed to support so many duplications (in fact more than 10 will probably start to be too much). We are supposing that when you know that a given peace of code has more than 100 duplicates, there is little value to know exactly how many and their location.


++

Julien

Jean-Pierre FAYOLLE

unread,
Dec 7, 2015, 5:04:39 AM12/7/15
to SonarQube
Hello Julien,

Yes I understand this point of view: better not have a slow UI to show hundreds of duplications when you are a developer frequently using SonarQube.
Now for a manager, no matter if duplications are shown or if their location is known but having their numbers has some value. Especially with verbose languages like Cobol or Abap.
If you want to refactor an application by developing reusable services, the number of duplications is an useful information.

May I suggest that this number is calculated during the analysis but the UI shows only the 1st one hundred? Or even less, this could be a parameter.
I believe this would not weigh on performance and it looks to me more logical than stopping the calculation when some UI limit is reached.

Best regards.
JP


On Monday, December 7, 2015 at 9:33:52 AM UTC+1, Julien HENRY wrote:
Hi Jean-Pierre,

Currently this limit is hard coded since the UI is not designed to support so many duplications (in fact more than 10 will probably start to be too much). We are supposing that when you know that a given peace of code has more than 100 duplicates, there is little value to know exactly how many and their location.


++

Julien

Le mercredi 2 décembre 2015 18:54:02 UTC+1, Jean-Pierre FAYOLLE a écrit :
Hello,

Analyzing Cobol (for a post on my blog), I have a lot of messages: "Too many duplication references on file .. for block .. Keep only the first 100 references."
Is there any way (property?) to change this so that I can have all references for each file?

I could only find "sonar.cpd.${language}.minimumTokens" and I think this property is not related with what I want to do.

Do not hesitate to ask for any precision.
Best regards.

Jean-Pierre FAYOLLE
www.qualilogy.com

Julien HENRY

unread,
Dec 7, 2015, 8:13:46 AM12/7/15
to SonarQube
AFAIK we don't stop computation. Only storage of duplication details is truncated (ie what is used for the UI).

Pierre-Yves Nicolas

unread,
Dec 7, 2015, 8:18:23 AM12/7/15
to Julien HENRY, SonarQube
Hi,

I think that's going to change in SQ 5.3 even if the following ticket does not mention metrics explicitly:

Pierre-Yves

--
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/b0552ed9-657a-4723-af29-3bf2a9416666%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Jean-Pierre FAYOLLE

unread,
Dec 8, 2015, 7:57:15 AM12/8/15
to SonarQube
Hello,

I can see in the SonarQube database that the number of duplicated block is indeed calculated for Java (rule 423/DuplicatedBlocks)
/* Project   Name                    Message                                                               Technical_debt
Extranet    dptsrvep005.java    103 duplicated blocks of code must be removed.        1040
Extranet    dptsrvep010.java    128 duplicated blocks of code must be removed.        1290
Extranet    dptsrvep400.java    199 duplicated blocks of code must be removed.        2000
Extranet    dptsrvep020.java    308 duplicated blocks of code must be removed.        3090
*/

But I cannot get any result on Cobol analysis (rule 1199/DuplicatedBlocks)

In SonarQube, I open the dashboard for the Java project where I can see the number of files duplicated. Click on this number to open the Issues (module/file) page for Dupicated Files. Click on the first file open the file with its total number of Issues. Click on this number open the Issues page where I can see issue 'x duplicated blocks of code must be removed' for this file.
Doing the same with a Cobol project does not show any issue in the Issues page even if I have x files with duplications.

Another way: go to the project, then Issues, then check 'Rules' and enter 'duplicated' in the Search field, select '(Java) Source files should not have duplicated blocks' shows all the issues for this rule on the selected project. Same with a Cobol project shows 0 issues. Although there are metrics for duplications (lines, blocks, files).

I will investigate further with other Cobol analysis and ABAP code and check if I did something wrong, so this is for you info.
Anyway, I will keep you informed (or should I continue through another list as it could concern only commercial plugins?)

Best regards.
Jean-Pierre

Pierre-Yves Nicolas

unread,
Dec 8, 2015, 11:06:13 AM12/8/15
to Jean-Pierre FAYOLLE, SonarQube
Hi Jean-Pierre,

This seems strange.
Did you check whether the DuplicatedBlocks rule is activated for COBOL?
Otherwise, yes, it would be more appropriate to contact SonarSource support.

Regards,
Pierre-Yves

--
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.
Reply all
Reply to author
Forward
0 new messages