Search code examples
sonarqubesonarqube-scansonar-runnersonarlint

Sonarrule to control maximum number of functions inside a class


  1. Is there any sonar rule to control the maximum number of functions inside a Java or .Net class?

  2. I saw rule

Files should not have too many lines of code : squid:S00104

It has the default value 750. Can anybody please tell me how to change the default value?


Solution

  • Ad 1. You are looking for S1448 and S1820. Check:

    https://rules.sonarsource.com/java/RSPEC-1448

    https://rules.sonarsource.com/java/RSPEC-1820

    Ad 2. You can change default value with sql update on database. Check this sql select:

    SELECT TOP 1 * FROM [dbo].[rules_parameters]
    WHERE rule_id = 
    (SELECT TOP 1 [id] FROM [dbo].[rules] WHERE [plugin_rule_key] = 'S00104')