Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 'INFO' and 'BLOCKER' for rule quality severity #4462

Merged
merged 3 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion docs/metadata.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ You can update the quickfix field using this GitHub Workflow: https://github.com

The code field is an object that contains information related to the clean code taxonomy. It is an object with two required properties:

* `impacts`: A nested object that is treated as a mapping from a software quality to a level (`"LOW"`, `"MEDIUM"` or `"HIGH"`). Note that at least one software quality has to be specified. The current list of allowed software qualities is `"MAINTAINABILITY"`, `"RELIABILITY"` and `"SECURITY"`.
* `impacts`: A nested object that is treated as a mapping from a software quality to a level (`"INFO"`, `"LOW"`, `"MEDIUM"`, `"HIGH"` or `"BLOCKER"`). Note that at least one software quality has to be specified. The current list of allowed software qualities is `"MAINTAINABILITY"`, `"RELIABILITY"` and `"SECURITY"`.

* `attribute`: A single clean code attribute that the rule aims to achieve. This has to be one of the following values: `"FORMATTED"`, `"CONVENTIONAL"`, `"IDENTIFIABLE"`, `"CLEAR"`, `"LOGICAL"`, `"COMPLETE"`, `"EFFICIENT"`, `"FOCUSED"`, `"DISTINCT"`, `"MODULAR"`, `"TESTED"`, `"LAWFUL"`, `"TRUSTWORTHY"`, `"RESPECTFUL"`.
6 changes: 3 additions & 3 deletions rspec-tools/rspec_tools/validation/rule-metadata-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,15 +267,15 @@
"properties": {
"MAINTAINABILITY": {
"type": "string",
"enum": ["LOW", "MEDIUM", "HIGH"]
"enum": ["INFO", "LOW", "MEDIUM", "HIGH", "BLOCKER"]
},
"RELIABILITY": {
"type": "string",
"enum": ["LOW", "MEDIUM", "HIGH"]
"enum": ["INFO", "LOW", "MEDIUM", "HIGH", "BLOCKER"]
},
"SECURITY": {
"type": "string",
"enum": ["LOW", "MEDIUM", "HIGH"]
"enum": ["INFO", "LOW", "MEDIUM", "HIGH", "BLOCKER"]
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion rspec-tools/tests/validation/test_metadata_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_rule_with_invalid_impacts(invalid_rules: RulesRepository):

def test_rule_with_invalid_impact_level(invalid_rules: RulesRepository):
s506 = invalid_rules.get_rule('S506')
with pytest.raises(RuleValidationError, match=re.escape("Rule S506 failed validation for these reasons:\n - Rule scala:S506 has invalid metadata in MAINTAINABILITY: 'INVALID' is not one of ['LOW', 'MEDIUM', 'HIGH']")):
with pytest.raises(RuleValidationError, match=re.escape("Rule S506 failed validation for these reasons:\n - Rule scala:S506 has invalid metadata in MAINTAINABILITY: 'INVALID' is not one of ['INFO', 'LOW', 'MEDIUM', 'HIGH', 'BLOCKER']")):
validate_rule_metadata(s506)


Expand Down
14 changes: 4 additions & 10 deletions rules/S1032/cfamily/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand All @@ -17,19 +17,13 @@
"based-on-misra"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1032",
"sqKey": "S1032",
"scope": "Main",
"defaultQualityProfiles": [

],
"defaultQualityProfiles": [],
"quickfix": "unknown"
}
10 changes: 3 additions & 7 deletions rules/S1036/cfamily/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand All @@ -19,12 +19,8 @@
"pitfall"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1036",
Expand Down
2 changes: 1 addition & 1 deletion rules/S1048/csharp/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Finalizers should not throw exceptions",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
"RELIABILITY": "BLOCKER"
},
"attribute": "LOGICAL"
},
Expand Down
2 changes: 1 addition & 1 deletion rules/S1048/vbnet/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "Finalize method should not throw exceptions",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
"RELIABILITY": "BLOCKER"
},
"attribute": "LOGICAL"
},
Expand Down
10 changes: 3 additions & 7 deletions rules/S1058/plsql/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
"RELIABILITY": "BLOCKER"
},
"attribute": "LOGICAL"
},
Expand All @@ -12,13 +12,9 @@
"func": "Constant\/Issue",
"constantCost": "30min"
},
"tags": [

],
"tags": [],
"extra": {
"replacementRules": [

],
"replacementRules": [],
"legacyKeys": [
"PipelinedFunctionsWithoutPipeRow"
]
Expand Down
10 changes: 3 additions & 7 deletions rules/S1069/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CONVENTIONAL"
},
Expand All @@ -17,12 +17,8 @@
"sql"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1069",
Expand Down
10 changes: 3 additions & 7 deletions rules/S1074/plsql/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
"RELIABILITY": "BLOCKER"
},
"attribute": "COMPLETE"
},
Expand All @@ -12,13 +12,9 @@
"func": "Constant\/Issue",
"constantCost": "1h"
},
"tags": [

],
"tags": [],
"extra": {
"replacementRules": [

],
"replacementRules": [],
"legacyKeys": [
"ForallStatementShouldUseSaveExceptionsClause"
]
Expand Down
10 changes: 3 additions & 7 deletions rules/S1139/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
"RELIABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand All @@ -16,12 +16,8 @@
"sql"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1139",
Expand Down
14 changes: 4 additions & 10 deletions rules/S1147/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CONVENTIONAL"
},
Expand All @@ -17,12 +17,8 @@
"suspicious"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1147",
Expand All @@ -33,8 +29,6 @@
382
]
},
"defaultQualityProfiles": [

],
"defaultQualityProfiles": [],
"quickfix": "unknown"
}
2 changes: 1 addition & 1 deletion rules/S1190/java/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CONVENTIONAL"
},
Expand Down
10 changes: 3 additions & 7 deletions rules/S1219/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand All @@ -16,12 +16,8 @@
"suspicious"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1219",
Expand Down
10 changes: 3 additions & 7 deletions rules/S1232/cfamily/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
"RELIABILITY": "BLOCKER"
},
"attribute": "LOGICAL"
},
Expand All @@ -18,12 +18,8 @@
"cert"
],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Blocker",
"ruleSpecification": "RSPEC-1232",
Expand Down
6 changes: 2 additions & 4 deletions rules/S128/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand All @@ -17,9 +17,7 @@
"suspicious"
],
"extra": {
"replacementRules": [

],
"replacementRules": [],
"legacyKeys": [
"non-empty-case-without-break",
"NonEmptyCaseWithoutBreak"
Expand Down
18 changes: 5 additions & 13 deletions rules/S1309/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW"
"MAINTAINABILITY": "INFO"
},
"attribute": "CLEAR"
},
Expand All @@ -12,23 +12,15 @@
"func": "Constant\/Issue",
"constantCost": "10min"
},
"tags": [

],
"tags": [],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Info",
"ruleSpecification": "RSPEC-1309",
"sqKey": "S1309",
"scope": "All",
"defaultQualityProfiles": [

],
"defaultQualityProfiles": [],
"quickfix": "unknown"
}
2 changes: 1 addition & 1 deletion rules/S131/pli/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"title": "\"SELECT\" statements should end with \"OTHERWISE\" statements",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand Down
6 changes: 2 additions & 4 deletions rules/S1314/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
"MAINTAINABILITY": "BLOCKER"
},
"attribute": "CLEAR"
},
Expand All @@ -16,9 +16,7 @@
"pitfall"
],
"extra": {
"replacementRules": [

],
"replacementRules": [],
"legacyKeys": [
"OctalConstantAndSequence",
"OctalNumber"
Expand Down
Loading