Possibility to define "sonar.sourceEncoding" per file type?

1,102 views
Skip to first unread message

alix....@gmail.com

unread,
Feb 1, 2018, 5:40:31 AM2/1/18
to SonarQube
Hi,

I was wondering if it's possible to avoid warnings such as:

Invalid character encountered in file /builds/.../src/main/res/mipmap-hdpi/ic_launcher_round.png at line 1 for encoding UTF-8. Please fix file content or configure the encoding to be used using property 'sonar.sourceEncoding'.

by specifying a different source encoding for PNG files. 
Does anybody know if it's possible to allow different encodings depending on file type?

Regards
Alix

Scott B.

unread,
Feb 1, 2018, 5:59:15 AM2/1/18
to SonarQube
Hi.

PNG files don't have any encoding, they are binary files. You should exclude this directory from the SonarQube analysis, using the property sonar.exclusions to the scanner.

ScottbToo .

unread,
Feb 1, 2018, 7:28:47 AM2/1/18
to Alix Warnke, SonarQube
Please reply to the list, not just to me ;-)

I never analyzed any Android project with SonarQube, but if I recall correctly there isn't any coding rules related to image files.

On Thu, Feb 1, 2018 at 9:08 AM, Alix Warnke <alix....@gmail.com> wrote:
Hi Scott,
Thanks for the suggestion.
But then I would not getting validation of resolution depth etc for the image file (android rules)?

--
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/RfCEaWvXllQ/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/f1a24873-e150-4a72-a32b-68abeaa81894%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien HENRY

unread,
Feb 1, 2018, 8:17:02 AM2/1/18
to SonarQube
Hi all,

AFAIR Android Lint is able to report issues on images (when resolution is not correct). On SonarQube side we have decided to focus on source code. That's why we are only importing source files, and only supporting source level issues. Even is this is not common, we are still supporting project level issues. So the Android Lint SonarQube plugin should be modified to report such issues on the project, but not try to report them on images. And images (like all binary files) should indeed be excluded from the analysis.

Regards,

Julien
Reply all
Reply to author
Forward
0 new messages