Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@stoyanK7
Copy link
Contributor

@stoyanK7 stoyanK7 commented Nov 4, 2025

Issue

Description

PR is still in draft state. We have to decide if it's maybe better to make a separate check for the problem in the PR - #17728 (comment)

TODO

  • Add input file in src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace

Diff Regression config: https://gist.githubusercontent.com/stoyanK7/c945ccc86ba9c276b8273166450310a1/raw/fadc1096c3837004872272371b8bff5455e8da2a/config.xml
Diff Regression patch config: https://gist.githubusercontent.com/stoyanK7/0b4ea73cb2d6f5446636dbe769394efb/raw/974d365b3b8b442e0fb38e479e2a4e9486e39ced/gistfile1.txt

@stoyanK7
Copy link
Contributor Author

stoyanK7 commented Nov 4, 2025

GitHub, generate report by config from src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/whitespaceafter/InputWhitespaceAfterType.java


followedByWhitespace = codePoint == ';'
|| codePoint == ')'
|| codePoint == ','
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One problem is that this change has an impact on other tokens (not only on TYPE), because the method is shared.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

Report generation failed. Please check the logs for more details.

Link: https://github.com/checkstyle/checkstyle/actions/runs/19075665008

@romani
Copy link
Member

romani commented Nov 5, 2025

This approach for triggering will not work, as no such token in master branch of checkstyle.
I think we need here old diff report workflow, that has two configs.

@stoyanK7
Copy link
Contributor Author

stoyanK7 commented Nov 5, 2025

Github, generate report

@github-actions
Copy link
Contributor

github-actions bot commented Nov 5, 2025

@stoyanK7
Copy link
Contributor Author

stoyanK7 commented Nov 5, 2025

There are cases where this solution becomes opinionated:

For example String... someStr. Do we consider String... as a single type? It is composed of TYPE and ELLIPSIS. Should it be String ... someStr or String... someStr.

Or int/*Some javadoc*/ myNums. Should the space be after the int or after the Javadoc? Some repos seem okay with no space between the two, others have it.

Or C-Style Arrays char someChars[];. These require extra attention, because the [] is part of the char TYPE.

IMO, we should create a new check for square brackets only - similar to GenericWhitespace.

@romani
Copy link
Member

romani commented Nov 5, 2025

IMO, we should create a new check for square brackets only - similar to GenericWhitespace.

Thanks a lot for analysis. Please create new issue, let's agree on naming, this PR should be linked as justification on new Check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants