From db3882d478c4c76955c712e162705b0ebaeaf662 Mon Sep 17 00:00:00 2001 From: dbouman Date: Fri, 22 Dec 2023 14:14:46 +0100 Subject: [PATCH] Add rules for checks for too many lines. Fixes #63 --- rules/cs.txt | 1 + rules/java.txt | 5 +++++ rules/js.txt | 1 + rules/kotlin.txt | 3 +++ rules/swift.txt | 4 ++++ rules/vbnet.txt | 2 ++ rules/web.txt | 1 + 7 files changed, 17 insertions(+) diff --git a/rules/cs.txt b/rules/cs.txt index f62482e..84d0b3b 100644 --- a/rules/cs.txt +++ b/rules/cs.txt @@ -8,4 +8,5 @@ +csharpsquid:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) +csharpsquid:S1309 # Violation suppression; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#suppressed-violations) +csharpsquid:S1541|maximumFunctionComplexityThreshold=10 # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#complex-units) ++csharpsquid:S1151 # Switch case clauses should not have too many lines of code. Used by Quality-time #end please ensure every rule ends with a new line character diff --git a/rules/java.txt b/rules/java.txt index cf599cd..e9d8886 100644 --- a/rules/java.txt +++ b/rules/java.txt @@ -9,4 +9,9 @@ +java:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) +java:S107|max=5 # Too many parameters; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#many-parameters) +java:S125 # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#commented-out-code) ++java:S104 # Files should not have too many lines of code. Used by Quality-time ++java:S1151 # Switch case clauses should not have too many lines of code. Used by Quality-time ++java:S1188 # Anonymous classes should not have too many lines. Used by Quality-time ++java:S2972 # Inner classes should not have too many lines of code. Used by Quality-time ++java:S5612 # Lambdas should not have too many lines. Used by Quality-time #end please ensure every rule ends with a new line character diff --git a/rules/js.txt b/rules/js.txt index 0b08c5c..1b5c71a 100644 --- a/rules/js.txt +++ b/rules/js.txt @@ -7,5 +7,6 @@ +javascript:S109 # Magic numbers; NOT used by Quality-time +javascript:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) +javascript:S125 # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#commented-out-code) ++javascript:S104 # Files should not have too many lines of code. Used by Quality-time # Missing: NoSonar, NCSS, Parameters #end please ensure every rule ends with a new line character diff --git a/rules/kotlin.txt b/rules/kotlin.txt index d4ff614..6412307 100644 --- a/rules/kotlin.txt +++ b/rules/kotlin.txt @@ -2,3 +2,6 @@ +kotlin:S1067 # Expression too complex; NOT used by Quality-time +kotlin:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) +kotlin:S107|Max=5 # Too many parameters; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#many-parameters) ++kotlin:S104 # Files should not have too many lines of code. Used by Quality-time ++kotlin:S1151 # When clauses should not have too many lines of code. Used by Quality-time ++kotlin:S5612 # Lambdas should not have too many lines. Used by Quality-time diff --git a/rules/swift.txt b/rules/swift.txt index dc2e457..ea301e6 100644 --- a/rules/swift.txt +++ b/rules/swift.txt @@ -4,4 +4,8 @@ +swift:S138|max=20 # Methods with too many lines; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#long-units-from-sonarqube) +swift:S107|functionMax=5 # Too many parameters; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#many-parameters-from-sonarqube) +swift:S125 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#commented-out-code-from-sonarqube) ++swift:S104 # Files should not have too many lines of code. Used by Quality-time ++swift:S1151 # Switch case clauses should not have too many lines of code. Used by Quality-time ++swift:S1188 # Closures should not have too many lines. Used by Quality-time ++swift:S2042 # Classes should not have too many lines of code. Used by Quality-time #end please ensure every rule ends with a new line character diff --git a/rules/vbnet.txt b/rules/vbnet.txt index 6eca490..c1e837e 100644 --- a/rules/vbnet.txt +++ b/rules/vbnet.txt @@ -3,5 +3,7 @@ +vbnet:S1067 # Expression too complex; NOT used by Quality-time +vbnet:S107|max=5 # Too many parameters; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#many-parameters) +vbnet:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) ++vbnet:S104 # Files should not have too many lines of code. Used by Quality-time ++vbnet:S1151 # Select Case clauses should not have too many lines of code. Used by Quality-time # Missing: method length, NoSonar, too many parameters, commented loc #end please ensure every rule ends with a new line character diff --git a/rules/web.txt b/rules/web.txt index 85f4738..9c01c80 100644 --- a/rules/web.txt +++ b/rules/web.txt @@ -2,4 +2,5 @@ +Web:ComplexityCheck # NOT used by Quality-time. Rule is deprecated, see https://rules.sonarsource.com/html/RSPEC-1908?search=complexity +Web:LongJavaScriptCheck # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) +Web:AvoidCommentedOutCodeCheck # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#commented-out-code) ++Web:FileLengthCheck # Files should not have too many lines. Used by Quality-time #end please ensure every rule ends with a new line character