Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

build: Added WhitespaceAround and WhitespaceAfter rules to Checkstyle config #625

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

Oliver-Loeffler
Copy link
Collaborator

@Oliver-Loeffler Oliver-Loeffler commented Mar 27, 2023

Issue

Actually I was wrong with adding the OperatorWrap check as solution to test for leading/trailing spaces around operators.
OperatorWrap only ensures that we get the following pattern when line wraps are needed: The proper solution here is to use WhitespaceAround and WhitespaceAfter.

Checkstyle will complain this one using OperatorWrap:

        int d = c +
                10;

It will permit:

        int d = c
                + 10;

To check if e.g. spaces are placed around operators or lambdas or behind a comma, following 2 rules apply.
Please test so we can find a suitable configuration.

        <module name="WhitespaceAfter"/>
        <module name="WhitespaceAround"/>

This setup ensures that we actually get the whitespaces around lambdas, around operators +, ||, etc and it ensures that e.g. missing whitespace after , or { is detected.

WhitespaceAround: https://checkstyle.org/config_whitespace.html#WhitespaceAround
WhitespaceAfter: https://checkstyle.org/config_whitespace.html#WhitespaceAfter

Fixes #620

Progress

…ound and WhitespaceAfter rules are testing e.g. if lambda operators or commas are properly formatted.
@abhinayagarwal abhinayagarwal merged commit 95d9fdf into gluonhq:master Mar 28, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

build: Add OperatorWrap rule to checkstyle
2 participants