--- /dev/null
+{"total": 5, "rules": [
+ {
+ "key": "squid:S1067",
+ "repo": "squid",
+ "lang": "java",
+ "name": "Expressions should not be too complex",
+ "htmlDesc": "<p>\nThe complexity of an expression is defined by the number of <code>&&</code>, <code>||</code> and <code>condition ? ifTrue : ifFalse</code> operators it contains.\nA single expression's complexity should not become too high to keep the code readable.\n</p>\n\n<p>The following code, with a maximum complexity of 3:</p>\n\n<pre>\nif (condition1 && condition2 && condition3 && condition4) { /* ... */ } // Non-Compliant\n</pre>\n\n<p>could be refactored into something like:</p>\n\n<pre>\nif (relevantMethodName1() && relevantMethodName2()) { /* ... */ } // Compliant\n\n/* ... */\n\nprivate boolean relevantMethodName1() {\n return condition1 && condition2;\n}\n\nprivate boolean relevantMethodName2() {\n return condition3 && condition4;\n}\n</pre>",
+ "status": "READY",
+ "template": false,
+ "internalKey": "S1067",
+ "severity": "MAJOR",
+ "tags": [],
+ "sysTags": ["brain-overload"],
+ "params": [
+ {
+ "key": "max",
+ "desc": "Maximum number of allowed conditional operators in an expression",
+ "defaultValue": "3"
+ }
+ ],
+ "actives": [
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ },
+ {
+ "key": "Sonar way:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ }
+ ]
+ },
+ {
+ "key": "squid:MethodCyclomaticComplexity",
+ "repo": "squid",
+ "lang": "java",
+ "name": "Methods should not be too complex",
+ "htmlDesc": "<p>The Cyclomatic Complexity is measured by the number of\n\t(&&, ||) operators and (if, while, do, for, ?:, catch, switch,\n\tcase, return, throw) statements in the body of a class plus one for\n\teach constructor, method (but not getter/setter), static initializer,\n\tor instance initializer in the class. The last return stament in\n\tmethod, if exists, is not taken into account.</p>\n<p>\n\tEven when the Cyclomatic Complexity of a class is very high, this\n\tcomplexity might be well distributed among all methods. Nevertheless,\n\tmost of the time, a very complex class is a class which breaks the <a\n\t\thref=\"http://en.wikipedia.org/wiki/Single_responsibility_principle\">Single\n\t\tResponsibility Principle</a> and which should be re-factored to be split\n\tin several classes.\n</p>",
+ "status": "READY",
+ "template": false,
+ "internalKey": "MethodCyclomaticComplexity",
+ "severity": "MAJOR",
+ "tags": [],
+ "sysTags": ["brain-overload"],
+ "params": [
+ {
+ "key": "max",
+ "desc": "Maximum complexity allowed.",
+ "defaultValue": "10"
+ }
+ ],
+ "actives": [
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ },
+ {
+ "key": "Sonar way:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ }
+ ]
+ },
+ {
+ "key": "squid:ClassCyclomaticComplexity",
+ "repo": "squid",
+ "lang": "java",
+ "name": "Avoid too complex class",
+ "htmlDesc": "<p>The Cyclomatic Complexity is measured by the number of (&&, ||)\n\toperators and (if, while, do, for, ?:, catch, switch, case, return,\n\tthrow) statements in the body of a class plus one for each constructor,\n\tmethod (but not getter/setter), static initializer, or instance\n\tinitializer in the class. The last return stament in method, if exists,\n\tis not taken into account.</p>\n<p>\n\tEven when the Cyclomatic Complexity of a class is very high, this\n\tcomplexity might be well distributed among all methods. Nevertheless,\n\tmost of the time, a very complex class is a class which breaks the <a\n\t\thref='http://en.wikipedia.org/wiki/Single_responsibility_principle'>Single\n\t\tResponsibility Principle</a> and which should be re-factored to be split\n\tin several classes.\n</p>",
+ "status": "READY",
+ "template": false,
+ "internalKey": "ClassCyclomaticComplexity",
+ "severity": "MAJOR",
+ "tags": [],
+ "sysTags": ["brain-overload"],
+ "params": [
+ {
+ "key": "max",
+ "desc": "Maximum complexity allowed.",
+ "defaultValue": "200"
+ }
+ ],
+ "actives": [
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ },
+ {
+ "key": "Sonar way:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ }
+ ]
+ },
+ {
+ "key": "squid:S1160",
+ "repo": "squid",
+ "lang": "java",
+ "name": "Public methods should throw at most one checked exception",
+ "htmlDesc": "<p>\nUsing checked exceptions forces method callers to deal with errors, either by propagating them or by handling them.\nThis makes those exceptions fully part of the API of the method.\n</p>\n\n<p>\nTo keep the complexity for callers reasonable, methods should not throw more than one kind of checked exception.\n</p>\n\n<p>The following code:</p>\n\n<pre>\npublic void delete() throws IOException, SQLException { // Non-Compliant\n /* ... */\n}\n</pre>\n\n<p>should be refactored into:</p>\n\n<pre>\npublic void delete() throws SomeApplicationLevelException { // Compliant\n /* ... */\n}\n</pre>\n\nOverriding methods are not checked by this rule and are allowed to throw several checked exceptions.",
+ "status": "READY",
+ "template": false,
+ "internalKey": "S1160",
+ "severity": "MAJOR",
+ "tags": [],
+ "sysTags": ["error-handling"],
+ "params": [],
+ "actives": [
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ },
+ {
+ "key": "Sonar way:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ }
+ ]
+ },
+ {
+ "key": "squid:S1142",
+ "repo": "squid",
+ "lang": "java",
+ "name": "Methods should not contain too many return statements",
+ "htmlDesc": "<p>\nHaving too many return statements in a method increases the method's essential complexity because the flow of execution is broken each time a return statement is encountered.\nThis makes it harder to read and understand the logic of the method.\n</p>\n\n<p>\nThe following code snippet illustrates this rule with the default threshold of 3:\n</p>\n\n<pre>\npublic boolean myMethod() { // Non-Compliant as there are 4 return statements\n if (condition1) {\n return true;\n } else {\n if (condition2) {\n return false;\n } else {\n return true;\n }\n }\n return false;\n}\n</pre>",
+ "status": "READY",
+ "template": false,
+ "internalKey": "S1142",
+ "severity": "MAJOR",
+ "tags": [],
+ "sysTags": ["brain-overload"],
+ "params": [
+ {
+ "key": "max",
+ "desc": "Maximum allowed return statements per method",
+ "defaultValue": "3"
+ }
+ ],
+ "actives": [
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:S1067",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "3"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:MethodCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "10"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way:java:squid:ClassCyclomaticComplexity",
+ "override": false,
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "max",
+ "value": "200"
+ }
+ ]
+ },
+ {
+ "key": "Sonar way with Findbugs:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ },
+ {
+ "key": "Sonar way:java:squid:S1160",
+ "override": false,
+ "severity": "MAJOR",
+ "params": []
+ }
+ ]
+ }
+]}
\ No newline at end of file