Domanda

I analyzed my Android project with SonarQube (Android Lint profile).
By default, Lint shows missing translations as Critical, but I consider them a minor problem.

So I wrote this lint.xml file in the project's home (same folder as sonar-properties.xml):

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="MissingTranslation">
        <ignore path="res/values/constants.xml" />
    </issue>
</lint>

Unfortunately, SonarQube does not seem to take this file into account.
How to make SonarQube use my lint.xml?

È stato utile?

Soluzione

Like for every language plugin that offers rules in SonarQube, you should customize those rules (severity, parameters) your quality profile in SonarQube itself - not in a file that belongs to your project.

So in your case, you have to go on the quality profile used for your project, find the rule that creates issues for missing translations, and change its severity to minor.

Altri suggerimenti

@Fabrice - SonarSource Team

I have a different opinion.
In my case I tried to ignore the lint error unused resources.
So I configured the file lint.xml like this:

<?xml version="1.0" encoding="UTF-8"?>
<lint>
    <issue id="UnusedResources" severity="ignore"/>
</lint>

After that I ran ./gradlew lint to generate the Lint report and hosted the report in sonarqube server using ./gradlew sonarqube.

As a fact the Lint report does not contain the unusedresources error and does not show up on SonarQube server even though the rule is still active in my quality profile.

So according to me in this way we can make SonarQube use lint.xml.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top