File in exclusion list not excluded for duplication

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
  • SonarQube Version 8.5.1 (build 38104)
  • SonarQube Scanner 3.3.0.1492
  • what are you trying to achieve
  • exclude html files that should not be scanned for duplication
  • what have you tried so far to achieve this
  • added **/*.html to both -Dsonar.exclusions and -Dsonar.cpd.exclusions

In the log I could see that:

Excluded sources for duplication:[**/*.html]

and:

Excluded sources: [**/*.html]

also:

[NUMBER HERE] files ignored because of inclusion/exclusion patterns.

But still I’m getting duplication shown in the result.

I wonder if I missed something, or is there a way to see the list of files that are indeed excluded?

Thanks!

Hi,

Can you provide your analysis logs? And how about a screenshot of a duplication report that shouldn’t be there?

 
Ann

Hi, thanks for the help, I tried to get the analysis log but it’s used on a CI and the log is mixed with other stuff, what I could see is a line in the log:

ANALYSIS SUCCESSFUL, you can browse [URL]

The URL above takes me to the dashboard for that particular PR with coverage problem. I guess that’s like a UI version of the textual analysis report, or does the analysis report provides more information other than what the dashboard shows?

Also:

More about the report processing at [URL]

The URL above shows me a JSON content with fields “task”, “analysisID”, “status”, etc, and the “status” is “SUCCESS”.

Below is the screenshot of the duplication on dashboard:

Regards

Hi,

Thanks for the screenshot. That’s a good first step. Now we need the logs before we can progress. Where you saw the ‘ANALYSIS SUCCESSFUL’ line is the right place to look. See if you can just copy/paste from the analysis command through that message.

 
Ann

Thanks, the Sonar instance is executed via CI, so I don’t get much information apart from the generic logs, around ‘ANALYSIS SUCCESSFUL’ there are logs like:

Analysis report generated in Xms
Analysis report compressed in Yms
Analysis report uploaded in Zms

But I’ve finally figured it out! I had to add an dummy/empty element in the end of the parameter array, so for sonar.cpd.exclusion the last part looks like:

"**/*.html", ""

Looks like the last element is ignored, and I found it’s the same case also for scan and coverage exclusion.

So now the problem is solved, but why is this the case I’m not sure.