File tree Expand file tree Collapse file tree
src/main/java/org/sonar/plugins/checkstyle Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2525 <suppress checks =" AnonInnerLength" files =" .*[\\/]src[\\/]test[\\/]" />
2626 <suppress checks =" ClassDataAbstractionCoupling" files =" .*[\\/]src[\\/]test[\\/]" />
2727 <suppress checks =" TrailingComment" files =" .*[\\/]Checkstyle(RulesDefinition|Metadata)\.java" />
28-
29- <!-- Suppress these checks until the plugin is upgraded to 13.4.1 and works with the dependency and Java upgrades. -->
30- <suppress checks =" UseEnhancedSwitch" files =" .*[\\/]src[\\/]main[\\/]" />
31- <suppress checks =" MissingNullCaseInSwitch" files =" .*[\\/]src[\\/]main[\\/]" />
3228</suppressions >
Original file line number Diff line number Diff line change @@ -28,24 +28,12 @@ private CheckstyleSeverityUtils() {
2828 }
2929
3030 public static String toSeverity (String priority ) {
31- final String result ;
32-
33- switch (priority ) {
34- case "BLOCKER" :
35- case "CRITICAL" :
36- result = SeverityLevel .ERROR .getName ();
37- break ;
38- case "MAJOR" :
39- result = SeverityLevel .WARNING .getName ();
40- break ;
41- case "MINOR" :
42- case "INFO" :
43- result = SeverityLevel .INFO .getName ();
44- break ;
45- default :
31+ return switch (priority ) {
32+ case "BLOCKER" , "CRITICAL" -> SeverityLevel .ERROR .getName ();
33+ case "MAJOR" -> SeverityLevel .WARNING .getName ();
34+ case "MINOR" , "INFO" -> SeverityLevel .INFO .getName ();
35+ case null , default ->
4636 throw new IllegalArgumentException ("Priority not supported: " + priority );
47- }
48-
49- return result ;
37+ };
5038 }
5139}
Original file line number Diff line number Diff line change @@ -257,23 +257,12 @@ private static boolean isMoreThanVarCharSizeLimit(String... values) {
257257 * @return sonar property type
258258 */
259259 private static RuleParamType getPropertyType (ModulePropertyDetails modulePropertyDetails ) {
260- final RuleParamType result ;
261- switch (modulePropertyDetails .getType ()) {
262- case "boolean" :
263- result = RuleParamType .BOOLEAN ;
264- break ;
265- case "int" :
266- case "long" :
267- result = RuleParamType .INTEGER ;
268- break ;
269- case "float" :
270- case "double" :
271- result = RuleParamType .FLOAT ;
272- break ;
273- default :
274- result = RuleParamType .STRING ;
275- }
276- return result ;
260+ return switch (modulePropertyDetails .getType ()) {
261+ case "boolean" -> RuleParamType .BOOLEAN ;
262+ case "int" , "long" -> RuleParamType .INTEGER ;
263+ case "float" , "double" -> RuleParamType .FLOAT ;
264+ case null , default -> RuleParamType .STRING ;
265+ };
277266 }
278267
279268 /**
You can’t perform that action at this time.
0 commit comments