Skip to content

Commit

Permalink
SONARJAVA-4826 S6880 Use switch instead of if else for pattern matchi…
Browse files Browse the repository at this point in the history
…ng (#4726)

* SONARJAVA-4826 S6880 Use switch instead of if else for pattern matching

* Prototype implementation of quickfix

* Refactor + Improve quickfix indents

* Test first 3 quickfixes

* More rigorous implementation without quickfix

* Make test cases follow the spec more closely

* Implement quickfix

* Add test for guards + Test first quickfix

* Don't generate guards for constant cases + add tests

* Fix bugs with constant cases + Refactor

* Add test

* Inline constant argument

* Handle non-block branches + add tests

* Add test

* Add tests

* Fix autoscan

* Apply requested changes

* Lift returns when possible

* Add test case

* Reformatting
  • Loading branch information
ValentinAebi-sonar committed Mar 20, 2024
1 parent 61ef9d2 commit 2f70d6b
Show file tree
Hide file tree
Showing 9 changed files with 890 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2957,6 +2957,12 @@
"falseNegatives": 6,
"falsePositives": 0
},
{
"ruleKey": "S6880",
"hasTruePositives": true,
"falseNegatives": 0,
"falsePositives": 0
},
{
"ruleKey": "S6885",
"hasTruePositives": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"ruleKey": "S6880",
"hasTruePositives": true,
"falseNegatives": 0,
"falsePositives": 0
}
Loading

0 comments on commit 2f70d6b

Please sign in to comment.