Skip to content

Commit

Permalink
Enable S1197, S1220, S1223, S1488, S1598, S3008 on Test code (#4821)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaufco authored Jun 19, 2024
1 parent 28c3799 commit 75eb133
Show file tree
Hide file tree
Showing 10 changed files with 377 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ public void simpleTestFileJava() throws Exception {
// Issues reported by S1607 are no longer expected here as the check requires complete semantic to run properly.
assertThat(issues).extracting("ruleKey", "startLine", "inputFile.path", "severity").containsOnly(
// tuple("squid:S2970", 6, inputFile.getPath(), "BLOCKER"),
tuple("java:S2925", 7, inputFile.getPath(), IssueSeverity.MAJOR));
tuple("java:S2925", 7, inputFile.getPath(), IssueSeverity.MAJOR),
// expected issue
tuple("java:S1220", null, inputFile.getPath(), IssueSeverity.MINOR));
}

@Test
Expand Down
160 changes: 160 additions & 0 deletions its/ruling/src/test/resources/commons-beanutils/java-S1197.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,164 @@
"commons-beanutils:commons-beanutils:src/main/java/org/apache/commons/beanutils2/LazyDynaClass.java": [
104
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/BasicDynaBeanTestCase.java": [
113,
115,
136,
139,
285,
287,
983,
984
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/BeanUtilsTestCase.java": [
77,
233,
239,
245,
296,
302,
362,
368,
374,
437,
438,
444,
679,
681,
1334,
1335,
1337,
1559,
1559
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/ConvertUtilsTestCase.java": [
100,
205,
218,
219,
220,
221,
222,
223,
278,
280,
282,
287,
290,
304,
305,
306,
493,
494,
496,
679,
684,
694,
699
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/DynaBeanUtilsTestCase.java": [
59,
120,
122,
124,
151,
154,
244,
250,
256,
320,
326,
332,
385,
391,
451,
457,
463,
530,
532,
538,
565,
566,
572,
1111,
1112,
1114,
1205,
1205,
1234,
1235
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/DynaPropertyUtilsTestCase.java": [
53,
115,
117,
148,
151,
226,
232,
2611,
2612
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/DynaResultSetTestCase.java": [
51,
153
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/DynaRowSetTestCase.java": [
54,
156
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/NestedTestBean.java": [
72
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/PropertyUtilsTestCase.java": [
132,
294,
300,
571,
574,
1714,
1715,
1903,
3989,
3992,
4046,
4050
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/TestBean.java": [
229,
243
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/TestResultSet.java": [
754,
760
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/TestResultSetMetaData.java": [
46
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/locale/LocaleConvertUtilsTestCase.java": [
110,
249,
262,
263,
264,
265,
266,
267,
324,
326,
328,
333,
336,
351,
352,
353,
547,
548,
550,
644,
649,
659,
664
]
}
20 changes: 20 additions & 0 deletions its/ruling/src/test/resources/commons-beanutils/java-S1488.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,24 @@
528,
570
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/BasicDynaBeanTestCase.java": [
986
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java": [
181,
208,
226
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/DynaBeanUtilsTestCase.java": [
1237
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/DynaPropertyUtilsTestCase.java": [
2614
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java": [
150
],
"commons-beanutils:commons-beanutils:src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java": [
528
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@
187,
194
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java": [
177
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"org.eclipse.jetty:jetty-project:jetty-http/src/main/java/org/eclipse/jetty/http/QuotedQualityCSV.java": [
50
],
"org.eclipse.jetty:jetty-project:jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java": [
67
],
"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java": [
69
],
Expand All @@ -26,4 +29,20 @@
"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java": [
46
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java": [
329
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorCloseTestBase.java": [
40,
53
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/GracefulStopTest.java": [
57,
64,
71,
78,
85,
92,
99
]
}
9 changes: 9 additions & 0 deletions its/ruling/src/test/resources/eclipse-jetty/java-S1488.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,16 @@
187,
194
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/HttpOutputTest.java": [
177
],
"org.eclipse.jetty:jetty-project:jetty-util/src/main/java/org/eclipse/jetty/util/resource/JarResource.java": [
131
],
"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/RolloverFileOutputStreamTest.java": [
53
],
"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/ssl/X509Test.java": [
93
]
}
62 changes: 62 additions & 0 deletions its/ruling/src/test/resources/eclipse-jetty/java-S3008.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"org.eclipse.jetty:jetty-project:jetty-http/src/main/java/org/eclipse/jetty/http/QuotedQualityCSV.java": [
50
],
"org.eclipse.jetty:jetty-project:jetty-io/src/test/java/org/eclipse/jetty/io/SslConnectionTest.java": [
67
],
"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/HttpChannel.java": [
69
],
Expand All @@ -26,6 +29,56 @@
"org.eclipse.jetty:jetty-project:jetty-server/src/main/java/org/eclipse/jetty/server/handler/gzip/GzipHttpOutputInterceptor.java": [
46
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/AsyncStressTest.java": [
329
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/ConnectorCloseTestBase.java": [
40,
53
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/GracefulStopTest.java": [
57,
64,
71,
78,
85,
92,
99
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/StressTest.java": [
59,
60,
61
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/handler/BufferedResponseHandlerTest.java": [
46,
47,
48,
49,
50,
51
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/handler/ContextHandlerGetResourceTest.java": [
51
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/handler/InetAccessHandlerTest.java": [
49,
50,
51,
52
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/handler/ResourceHandlerTest.java": [
69,
70,
71,
72,
73,
74,
75
],
"org.eclipse.jetty:jetty-project:jetty-server/src/test/java/org/eclipse/jetty/server/ssl/SslSelectChannelTimeoutTest.java": [
35
],
"org.eclipse.jetty:jetty-project:jetty-slf4j-impl/src/main/java/org/eclipse/jetty/logging/JettyLoggingServiceProvider.java": [
35
],
Expand Down Expand Up @@ -73,5 +126,14 @@
],
"org.eclipse.jetty:jetty-project:jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java": [
51
],
"org.eclipse.jetty:jetty-project:jetty-util/src/test/java/org/eclipse/jetty/util/ScannerTest.java": [
50,
51,
52,
53
],
"org.eclipse.jetty:jetty-project:jetty-xml/src/test/java/org/eclipse/jetty/xml/TestConfiguration.java": [
35
]
}
17 changes: 17 additions & 0 deletions its/ruling/src/test/resources/sonar-server/java-S1488.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"org.sonarsource.sonarqube:sonar-server:src/test/java/org/sonar/server/component/ComponentServiceUpdateKeyTest.java": [
207
],
"org.sonarsource.sonarqube:sonar-server:src/test/java/org/sonar/server/computation/task/projectanalysis/scm/ScmInfoImplTest.java": [
132
],
"org.sonarsource.sonarqube:sonar-server:src/test/java/org/sonar/server/issue/ws/AssignActionTest.java": [
268
],
"org.sonarsource.sonarqube:sonar-server:src/test/java/org/sonar/server/notification/email/AlertsEmailTemplateTest.java": [
120
],
"org.sonarsource.sonarqube:sonar-server:src/test/java/org/sonar/server/permission/ws/template/SearchTemplatesActionTest.java": [
65
]
}
Loading

0 comments on commit 75eb133

Please sign in to comment.