Benjamin Marwell created COMDEV-336:
---------------------------------------
Summary: Code style should mention "else" style
Key: COMDEV-336
URL: https://issues.apache.org/jira/browse/COMDEV-336
Project: Community Development
Issue Type: Task
Components: Website
Reporter: Benjamin Marwell
Hello,
the "code style page" at
[https://maven.apache.org/developers/conventions/code.html] should mention the
code style associated with the {{else}} keyword.
Example: I created my first PR using guard statements and kept the main code on
the lowest possible indentation level. Only the reviwers told me that this is
uncommon in apache projects and not wanted. While I do not go with "it's
clearer to read", it is more common to read if you are used to it not to see
any code without indentation.
Here's my PR with the discussion:
[https://github.com/apache/maven-checkstyle-plugin/pull/17.] You can clearly
see how I struggled and was suprised with the comments, as checkstyle did went
through anyway.
That said, if this is what is wanted, this should be mentioned on the code
conventions page as well. Maybe even add a checkstyle rule ("no if containing
break/return" and "no if without else"). While I myself prefer to use guard
statements, it seems uncommon for apache projects.
Please update the documentation rules accordingly.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]