Add rust to rule S2185

This commit is contained in:
yassin-kammoun-sonarsource 2025-03-25 12:45:51 +00:00
parent f18135cc24
commit 2e607bb4cb
4 changed files with 74 additions and 28 deletions

View File

@ -1,30 +1,2 @@
{
"title": "Do not perform unnecessary mathematical operations",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "LOGICAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "15min"
},
"tags": [
"clumsy"
],
"extra": {
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-2185",
"sqKey": "S2185",
"scope": "All",
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "unknown"
}

View File

@ -1,2 +1,30 @@
{
"title": "Do not perform unnecessary mathematical operations",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "LOGICAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "15min"
},
"tags": [
"clumsy"
],
"extra": {
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Major",
"ruleSpecification": "RSPEC-2185",
"sqKey": "S2185",
"scope": "All",
"defaultQualityProfiles": [
"Sonar way"
],
"quickfix": "unknown"
}

View File

@ -0,0 +1,2 @@
{
}

View File

@ -0,0 +1,44 @@
FIXME: add a description
// If you want to factorize the description uncomment the following line and create the file.
//include::../description.adoc[]
== Why is this an issue?
FIXME: remove the unused optional headers (that are commented out)
//=== What is the potential impact?
== How to fix it
//== How to fix it in FRAMEWORK NAME
=== Code examples
==== Noncompliant code example
[source,rust,diff-id=1,diff-type=noncompliant]
----
FIXME
----
==== Compliant solution
[source,rust,diff-id=1,diff-type=compliant]
----
FIXME
----
//=== How does this work?
//=== Pitfalls
//=== Going the extra mile
//== Resources
//=== Documentation
//=== Articles & blog posts
//=== Conference presentations
//=== Standards
//=== External coding guidelines
//=== Benchmarks