-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from ICTU/rules-update
Rules update
- Loading branch information
Showing
13 changed files
with
158 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Maintenance related tasks | ||
|
||
|
||
## Version upgrade workflow | ||
|
||
1. Update `Dockerfile`s with the new version of SonarQube | ||
1. Update [external plugins](https://github.com/ICTU/sonar/blob/master/plugins/plugin-list) | ||
1. Create profiles based on the internal plugin versions in [start-with-profile.sh](https://github.com/ICTU/sonar/blob/rules-update/start-with-profile.sh) | ||
1. Obtain the base version numbers from the vanilla SonarQube image directory `/opt/sonarqube/lib/extensions`, excluding build number | ||
1. Update the profile version number `RULES_VERSION` if the rules have been changed | ||
1. Create new version tags on github | ||
1. `MAJOR.MINOR.PATCH` | ||
1. `MAJOR.MINOR.PATCH-developer` | ||
1. Build and push new images to docker hub with [CircleCI](https://app.circleci.com/pipelines/github/ICTU/sonar) | ||
|
||
|
||
## Adding plugins | ||
|
||
Add the url of the plugin jar-file to be installed to `plugins/plugin-list`. | ||
|
||
|
||
## Creating a new quality profile | ||
|
||
Modify `start-with-profile.sh` and add a statement to the end of the script, such as: | ||
|
||
createProfile "ictu-cs-profile-v6.6" "Sonar%20way" "cs" | ||
|
||
The parameters are: | ||
* Profile name | ||
* Base profile name | ||
* Language (internal SonarQube language identifier) | ||
|
||
|
||
## Create rules txt file from SonarQubes quality profile backup (xml) | ||
|
||
In order to make the importing of existing profiles easier, use the transformation `profile_backup_transform.xslt`. | ||
Go to the profiles page in your SonarQube instance, backup a profile to an xml file and transform it. | ||
|
||
|
||
## Activating or deactivating individual rules in the quality profiles | ||
|
||
Modify the corresponding `rules/(language).txt` file. | ||
Each line represents a rule to be activated or deactivated and has the following syntax: `(operation)(ruleId)#(comment)` | ||
Please ensure each file ends with a new line character, otherwise the rule will not be added to the profile | ||
|
||
* **operation**: `+` activates a rule; `-` deactivates a rule | ||
* **ruleId**: SonarQube rule identifier | ||
|
||
Example: | ||
|
||
+csharpsquid:S104 # NCSS; used by Quality-time | ||
|
||
|
||
## Activating or deactivating rule types in the quality profiles | ||
|
||
To (de)activate groups of rules by type use this syntax: | ||
`(operation)types=(comma,delimited,list,of,types)#(comment)` | ||
|
||
The following types are available: | ||
- `CODE_SMELL` | ||
- `BUG` | ||
- `VULNERABILITY` | ||
- `SECURITY_HOTSPOT` | ||
|
||
Example: | ||
|
||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default | ||
+csharpsquid:S104 # NCSS; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#long-units-from-sonarqube) | ||
+csharpsquid:S107|max=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) | ||
+csharpsquid:S125 # Commented code; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#commented-out-code-from-sonarqube) | ||
+csharpsquid:S104 # NCSS; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) | ||
+csharpsquid:S107|max=5 # Too many parameters; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#many-parameters) | ||
+csharpsquid:S125 # Commented code; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#commented-out-code) | ||
+csharpsquid:S134 # Depth of nesting; NOT used by Quality-time | ||
+csharpsquid:S1067 # Too complex expression; NOT used by Quality-time | ||
+csharpsquid:S1309 # Violation suppression; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#suppressed-violations-from-sonarqube) | ||
+csharpsquid:S1541|max=10 # Methods and properties too complex; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#complex-units-from-sonarqube) | ||
+csharpsquid:S109 # Magic numbers; NOT used by Quality-time | ||
+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) | ||
#end please ensure every rule ends with a new line character |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default | ||
+java:S1541|Threshold=10 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#complex-units-from-sonarqube) | ||
+java:NoSonar # Used by Quality-time to report on suppressed violations (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#suppressed-violations-from-sonarqube) | ||
+java:S1309 # Used by Quality-time to report on suppressed violations (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#suppressed-violations-from-sonarqube) | ||
+java:S1310 # Used by Quality-time to report on suppressed violations (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#suppressed-violations-from-sonarqube) | ||
+java:S1315 # Used by Quality-time to report on suppressed violations (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#suppressed-violations-from-sonarqube) | ||
+java:S1541|Threshold=10 # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#complex-units) | ||
+java:NoSonar # Used by Quality-time to report on suppressed violations (https://quality-time.readthedocs.io/en/latest/reference.html#suppressed-violations) | ||
+java:S1309 # Used by Quality-time to report on suppressed violations (https://quality-time.readthedocs.io/en/latest/reference.html#suppressed-violations) | ||
+java:S1310 # Used by Quality-time to report on suppressed violations (https://quality-time.readthedocs.io/en/latest/reference.html#suppressed-violations) | ||
+java:S1315 # Used by Quality-time to report on suppressed violations (https://quality-time.readthedocs.io/en/latest/reference.html#suppressed-violations) | ||
+java:S1067 # Expression too complex; NOT used by Quality-time | ||
+java:S109 # Magic numbers; NOT used by Quality-time | ||
+java: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) | ||
+java:S107|max=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) | ||
+java:S125 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#commented-out-code-from-sonarqube) | ||
+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) | ||
#end please ensure every rule ends with a new line character |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default | ||
+javascript:S1541|maximumFunctionComplexityThreshold=10 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#complex-units-from-sonarqube) | ||
+javascript:S1541|maximumFunctionComplexityThreshold=10 # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#complex-units) | ||
+javascript:S134 # NOT used by Quality-time | ||
+javascript:S1067 # Expression too complex; NOT used by Quality-time | ||
+javascript:S106 # Console logging should not be used; NOT used by Quality-time | ||
+javascript:S107|maximumFunctionParameters=5 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#many-parameters-from-sonarqube) | ||
+javascript:S125 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#commented-out-code-from-sonarqube) | ||
+javascript:S107|maximumFunctionParameters=5 # Too many parameters; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#many-parameters) | ||
+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) | ||
# Missing: NoSonar, NCSS, Parameters | ||
#end please ensure every rule ends with a new line character |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default | ||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default | ||
+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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
+types=SECURITY_HOTSPOT,VULNERABILITY # Enable these types by default | ||
+python:S104 # Too many lines of code in file; NOT used by Quality-time | ||
+python:S107|max=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) | ||
+python:S125 # Commented code; used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#commented-out-code-from-sonarqube) | ||
+python:S107|max=5 # Too many parameters; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#many-parameters) | ||
+python:NoSonar # Used by Quality-time to report on suppressed violations (https://quality-time.readthedocs.io/en/latest/reference.html#suppressed-violations) | ||
+python:S125 # Commented code; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#commented-out-code) | ||
+python:S134 # Too deep nesting; NOT used by Quality-time | ||
+python:FunctionComplexity|maximumFunctionComplexityThreshold=10 # Used by Quality-time (https://github.com/ICTU/quality-time/blob/master/docs/METRICS_AND_SOURCES.md#complex-units-from-sonarqube) | ||
+python:S138|max=20 # Methods with too many lines; used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#long-units) | ||
+python:FunctionComplexity|maximumFunctionComplexityThreshold=10 # Used by Quality-time (https://quality-time.readthedocs.io/en/latest/reference.html#complex-units) | ||
#end please ensure every rule ends with a new line character |
Oops, something went wrong.