Reputation: 2063
I am using sonarqube to check the quality of my code and I would like to override a rule but I don't manage to do it even by following the documentation. The rule I want to modify is about the exceeding code length in C# which by default uses the maximumLineLength parameter. I would like to modify and increase the value of this parameter but I don't find anywhere the chance to do it. Any help please?
Upvotes: 3
Views: 3266
Reputation: 2439
Add the following Rule in SonarLint.xml
<?xml version="1.0" encoding="UTF-8"?>
<AnalysisInput>
<Settings>
</Settings>
<Rules>
<Rule>
<Key>S103</Key>
<Parameters>
<Parameter>
<Key>maximumLineLength</Key>
<Value>240</Value>
</Parameter>
</Parameters>
</Rule>
</Rules>
<Files>
</Files>
</AnalysisInput>
and Modify the .csproj file to add the following.
<ItemGroup>
<AdditionalFiles Include="Properties\SonarLint.xml" />
</ItemGroup>
Upvotes: 2
Reputation: 6278
Try setting the attribute in your sonar-project.properties file. That way the default value will stay intact, but it will be set to your desired value per-project...
sonar.maximumLineLength = 300 (or whatever value you need)
Let us know if it worked.
Upvotes: 4