As a general rule, I would advise against creating even parts of the coding manual, as this can cause problems when receiving your software engineers. In addition, Checkstyle rules should, in my humble opinion, not be part of the coding document itself. Instead, the coding guidelines should say something like, "Be careful not to cause problems with Checkstyle."
The Checkstyle tool can be customized with information to show the developer a warning. Thus, developers will not need to open an external document to correctly resolve Checkstyle warnings, because all the necessary information already exists.
Example: LocalVariableName checks the naming convention for non-finite local variables. Default message text:
Member Names: Name 'Foo' must match pattern '^[az][a-zA-Z0-9]{0,31}$'.
If you configure the check as follows:
<module name="LocalVariableName"> <message key="name.invalidPattern" value="Local variable name ''{0}'' must not be longer than 32 alphanumeric characters and start with a lowercase letter. Regex: ''{1}''"/> </module>
Then the output will be:
Local variable name 'Foo' must not be longer than 32 alphanumeric characters and start with a lowercase letter. Regex: '^[az][a-zA-Z0-9]{0,31}$'
Admittedly, if all your developers knew their regular expressions well, a new message text would not be needed. But not everyone is a regular expression expert, and this is just an example that can be applied to many validations, including validations without regular expressions.
source share