Skip to content

Commit 2f70d6b

Browse files
SONARJAVA-4826 S6880 Use switch instead of if else for pattern matching (#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
1 parent 61ef9d2 commit 2f70d6b

9 files changed

Lines changed: 890 additions & 0 deletions

File tree

its/autoscan/src/test/resources/autoscan/autoscan-diff-by-rules.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2957,6 +2957,12 @@
29572957
"falseNegatives": 6,
29582958
"falsePositives": 0
29592959
},
2960+
{
2961+
"ruleKey": "S6880",
2962+
"hasTruePositives": true,
2963+
"falseNegatives": 0,
2964+
"falsePositives": 0
2965+
},
29602966
{
29612967
"ruleKey": "S6885",
29622968
"hasTruePositives": true,
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"ruleKey": "S6880",
3+
"hasTruePositives": true,
4+
"falseNegatives": 0,
5+
"falsePositives": 0
6+
}

0 commit comments

Comments
 (0)