Modify default parameter rule in SonarQube

Viewed 1792

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?

2 Answers

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>

Related