diff options
Diffstat (limited to 'src/xdocs/config_coding.xml')
-rw-r--r-- | src/xdocs/config_coding.xml | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/src/xdocs/config_coding.xml b/src/xdocs/config_coding.xml index 6f89b72af..91e2aaddf 100644 --- a/src/xdocs/config_coding.xml +++ b/src/xdocs/config_coding.xml @@ -464,7 +464,22 @@ public class A { more readable if it comes after the last <code>case</code>. </p> </subsection> - + <subsection name="Properties"> + <table> + <tr> + <th>name</th> + <th>description</th> + <th>type</th> + <th>default value</th> + </tr> + <tr> + <td>skipIfLastAndSharedWithCase</td> + <td>whether to allow <code>default</code> along with case if they are not last</td> + <td><a href="property_types.html#boolean">Boolean</a></td> + <td>false</td> + </tr> + </table> + </subsection> <subsection name="Examples"> <p> To configure the check: @@ -472,6 +487,35 @@ public class A { <source> <module name="DefaultComesLast"/> </source> + <p> + To configure the check for skipIfLastAndSharedWithCase: + </p> + <source> +<module name="DefaultComesLast"> + <property name="skipIfLastAndSharedWithCase" value="true"/> +</module> + </source> + <p> + Example when skipIfLastAndSharedWithCase is set to true. + </p> + <source> +switch (i) { + case 1: + break; + case 2: + default: // No violation with the new option is expected + break; + case 3: + break; +} +switch (i) { + case 1: + break; + default: // violation with the new option is expected + case 2: + break; +} + </source> </subsection> <subsection name="Example of Usage"> @@ -489,6 +533,10 @@ public class A { <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fcoding+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22default.comes.last%22"> default.comes.last</a> </li> + <li> + <a href="https://github.com/search?q=path%3Asrc%2Fmain%2Fresources%2Fcom%2Fpuppycrawl%2Ftools%2Fcheckstyle%2Fchecks%2Fcoding+filename%3Amessages*.properties+repo%3Acheckstyle%2Fcheckstyle+%22default.comes.last.in.casegroup%22"> + default.comes.last.in.casegroup</a> + </li> </ul> <p> All messages can be customized if the default message doesn't suit you. |