Skip to content

Commit

Permalink
Merge branch 'master' into rule/S7044-add-java
Browse files Browse the repository at this point in the history
  • Loading branch information
hendrik-buchwald-sonarsource authored Aug 20, 2024
2 parents 1bfd72c + 78333c7 commit c263a2e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 13 deletions.
18 changes: 5 additions & 13 deletions rules/S1772/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,20 @@
},
"attribute": "CONVENTIONAL"
},
"status": "ready",
"status": "deprecated",
"remediation": {
"func": "Constant\/Issue",
"constantCost": "10min"
},
"tags": [
"convention"
],
"tags": [],
"extra": {
"replacementRules": [

],
"legacyKeys": [

]
"replacementRules": [],
"legacyKeys": []
},
"defaultSeverity": "Minor",
"ruleSpecification": "RSPEC-1772",
"sqKey": "S1772",
"scope": "Main",
"defaultQualityProfiles": [

],
"defaultQualityProfiles": [],
"quickfix": "unknown"
}
3 changes: 3 additions & 0 deletions rules/S1854/dart/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{

}
53 changes: 53 additions & 0 deletions rules/S1854/dart/rule.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
include::../why.adoc[]

=== Exceptions

This rule ignores initializations to `-1`, `0`, `1`, `null`, `true`, `false` and `""`.

include::../howtofixit.adoc[]

=== Code examples

==== Noncompliant code example

[source,dart,diff-id=1,diff-type=noncompliant]
----
int foo(int y) {
int x = 100; // Noncompliant: dead store
x = 150; // Noncompliant: dead store
x = 200;
return x + y;
}
----

==== Compliant solution

[source,dart,diff-id=1,diff-type=compliant]
----
int foo(int y) {
int x = 200; // Compliant: no unnecessary assignment
return x + y;
}
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

=== Highlighting

The right-end side of the unnecessary assignment, including the assignment operator: e.g. `= 42`.

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]

0 comments on commit c263a2e

Please sign in to comment.