Sonarqube 6.7 Analyis ignore excludes

1,120 views
Skip to first unread message

Mark Lübbehüsen

unread,
Apr 12, 2018, 9:05:31 AM4/12/18
to SonarQube
Hi,

why Sonarqube ignore source exclusions?

[sonar:sonar] Excluded sources: 
[sonar:sonar]   **/*.txt
[sonar:sonar]   **/*.pdf
[sonar:sonar]   **/*.png
[sonar:sonar]   **/*.sh
[sonar:sonar]   **/*.pdf

[sonar:sonar] File '/app/jenkins/xxxxx/workspaces/xxxxx/xxxxxx/xxxxxx.txt' is ignored because it doesn't belong to 
the forced language 'java'

As you see I exclude the *.txt file, but the sonar analyser ignore it.

Why?

Thank,
Mark

G. Ann Campbell

unread,
Apr 12, 2018, 9:18:42 AM4/12/18
to SonarQube
Hi Mark,

There are several things going on here. 

First, your final log line holds a key clue: forced language 'java'

You have apparently included in your analysis configuration: sonar.language=java. Doing so disables multi-language analysis and thus forces the analysis to ignore files that don't correspond to the selected language.

But even if you hadn't forced a language, it appears that your project has been explicitly configured to exclude certain patterns, e.g. **/*.pdf. That's typically done via the UI by a project administrator.

But even if exclusions hadn't been configured, those files would probably still be ignored, because as far as I know, there aren't analyzers than handle .pdf, .png, and .sh files. File extensions that aren't "claimed" by a language analyzer are ignored by default, altho I don't believe that would show up in the log.


HTH,
Ann

Mark Lübbehüsen

unread,
Apr 12, 2018, 9:31:57 AM4/12/18
to SonarQube
Hi Ann,


Yes, I have set the property sonar.language=java.

My goal is to suppress the output of the log "[sonar:sonar] File '/app/jenkins/xxxxx/workspaces/xxxxx/xxxxxx/xxxxxx.txt' is ignored because it doesn't belong to
the forced language 'java'" and I have hoped that I will achieve it by putting the excludes.

Thanks,
Mark

G. Ann Campbell

unread,
Apr 12, 2018, 9:37:30 AM4/12/18
to Mark Lübbehüsen, SonarQube
Hi Mark,

I don't think you're going to be able to do that.


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/1uegpAdguGU/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/ba5cd2fb-60ef-42e9-867e-61da08999ccf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mark Lübbehüsen

unread,
Apr 13, 2018, 9:24:58 AM4/13/18
to SonarQube
Hi Ann,

my first experiences show that I can suppress the output of the log "[sonar:sonar] File '/app/jenkins/xxxxx/workspaces/xxxxx/xxxxxx/xxxxxx.txt' is ignored because it doesn't belong to 
the forced language 'java'" by setting "sonar.exclusions" in the UI for *.sh, *.sql and *.xml. 

For example for *.txt and *.csv ist doesnt work.

Can someone please explain it to me.

thanks,
Mark

To unsubscribe from this group and all its topics, send an email to sonarqube+...@googlegroups.com.

G. Ann Campbell

unread,
Apr 13, 2018, 10:08:48 AM4/13/18
to Mark Lübbehüsen, SonarQube
Hi Mark,

Can you tell me what you're trying to accomplish by suppressing these log lines? Off-hand I don't have any further answers regarding what does or does not go into the logs, but perhaps we can come at this from another direction.


Ann



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

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/cfa37f57-90cc-4793-9e40-9669a5a31d5c%40googlegroups.com.

Mark Lübbehüsen

unread,
Apr 16, 2018, 4:13:19 AM4/16/18
to SonarQube
Hi Ann,

I just want to shorten the log output to make it easier to read

thnaks,
Mark

G. Ann Campbell

unread,
Apr 16, 2018, 7:28:16 AM4/16/18
to Mark Lübbehüsen, SonarQube
Hi Mark,

I was afraid of that. I'm afraid there's no good way.


Ann



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

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/0799c8c8-3bff-40f5-b694-7b669e869d99%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages