diff --git a/builder/src/main/resources/application.yml b/builder/src/main/resources/application.yml index 8e7b58f..c371992 100644 --- a/builder/src/main/resources/application.yml +++ b/builder/src/main/resources/application.yml @@ -1538,3 +1538,10 @@ rules: enabled: true source: SEVNTU uri: http://sevntu-checkstyle.github.io/sevntu.checkstyle/apidocs/com/github/sevntu/checkstyle/checks/coding/MoveVariableInsideIfCheck.html + - + name: NoWhitespaceBeforeCaseDefaultColon + parent: TREEWALKER + level: LAYOUT + enabled: true + source: CHECKSTYLE + uri: https://checkstyle.sourceforge.io/config_whitespace.html#NoWhitespaceBeforeCaseDefaultColon diff --git a/builder/src/main/resources/rules/NoWhitespaceBeforeCaseDefaultColon.md b/builder/src/main/resources/rules/NoWhitespaceBeforeCaseDefaultColon.md new file mode 100644 index 0000000..98ceaf3 --- /dev/null +++ b/builder/src/main/resources/rules/NoWhitespaceBeforeCaseDefaultColon.md @@ -0,0 +1,29 @@ + +Checks that there is no whitespace before the colon in a switch block. . + +Valid: +```` +switch(1) { + case 1: + break; + case 2: + break; + default: + break; +} +```` + +Invalid: +```` +switch(2) { + case 2: // ok + break; + case 3, 4 + : break; // violation, whitespace before ':' is not allowed here + case 4, + 5: break; // ok + default + : // violation, whitespace before ':' is not allowed here + break; +} +````