new Check: SingleSpaceSeparator #3173

Closed
rnveach opened this Issue May 13, 2016 · 5 comments

Comments

Projects
None yet
2 participants
@rnveach
Member

rnveach commented May 13, 2016

Requested from spring-projects/spring-framework#898 (comment)

Implement check in CS:
sevntu-checkstyle/sevntu.checkstyle@0ebb670#diff-ebf8f89095ef0428ddd5e7e4975135b5

Author shared a python script for auto-fix of such violations: spring-projects/spring-framework#898 (comment)

ATTENTION: for sevntu-checkstyle users: there might be problem with loading of class by Checkstyle if both checkstyle and sevntu-checkstyle jars are used in validation. To resolve a problem please use fully qualified names in configurations, see fix at checkstyle/contribution@232ad78

@rnveach

This comment has been minimized.

Show comment
Hide comment
@rnveach

rnveach May 13, 2016

Member

@romani
As I am adding this check to CS, I notice I am getting errors from that check that exist in master and they look valid. Since we have checkstyle_sevntu_checks.xml I thought we were enforcing all the sevntu checks there in CS?

Config:
https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_sevntu_checks.xml#L64

Output:

[ERROR] \checkstyle\src\it\java\com\google\checkstyle\test\chapter4formatting\rule43onestatement\OneStatementPerLineTest.java:83:22: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\api\AbstractCheckTest.java:60:24: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\api\AbstractCheckTest.java:65:24: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\api\AbstractCheckTest.java:70:24: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\annotation\MissingDeprecatedCheckTest.java:46:53: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\design\OneTopLevelClassCheckTest.java:56:45: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\imports\IllegalImportCheckTest.java:43:49: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\indentation\IndentationCheckTest.java:324:54: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\indentation\IndentationCheckTest.java:1559:76: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\modifier\RedundantModifierCheckTest.java:133:22: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\naming\AbbreviationAsWordInNameCheckTest.java:53:19: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\sizes\LineLengthCheckTest.java:65:51: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\MainTest.java:634:51: Use a single space to separate tokens. [SingleSpaceSeparator]

Example:
https://github.com/checkstyle/checkstyle/blob/master/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java#L83
Line 83 has 2 spaces between quote and +.
https://github.com/checkstyle/checkstyle/blob/master/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractCheckTest.java#L60
Line 60 has 2 spaces between return and CommonUtils.

When I run "mvn checkstyle:checkstyle" all I am getting is:

[INFO] ------------------------------------------------------------------------
[INFO] Building checkstyle 6.19-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-checkstyle-plugin:2.17:checkstyle (default-cli) @ checkstyle ---
[INFO] There are 3 errors reported by Checkstyle 6.18 with D:\Rickys\checkstyleWorkspaceEclipse\checkstyle/config/checkstyle_sevntu_checks.xml ruleset.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
Member

rnveach commented May 13, 2016

@romani
As I am adding this check to CS, I notice I am getting errors from that check that exist in master and they look valid. Since we have checkstyle_sevntu_checks.xml I thought we were enforcing all the sevntu checks there in CS?

Config:
https://github.com/checkstyle/checkstyle/blob/master/config/checkstyle_sevntu_checks.xml#L64

Output:

[ERROR] \checkstyle\src\it\java\com\google\checkstyle\test\chapter4formatting\rule43onestatement\OneStatementPerLineTest.java:83:22: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\api\AbstractCheckTest.java:60:24: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\api\AbstractCheckTest.java:65:24: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\api\AbstractCheckTest.java:70:24: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\annotation\MissingDeprecatedCheckTest.java:46:53: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\design\OneTopLevelClassCheckTest.java:56:45: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\imports\IllegalImportCheckTest.java:43:49: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\indentation\IndentationCheckTest.java:324:54: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\indentation\IndentationCheckTest.java:1559:76: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\modifier\RedundantModifierCheckTest.java:133:22: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\naming\AbbreviationAsWordInNameCheckTest.java:53:19: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\checks\sizes\LineLengthCheckTest.java:65:51: Use a single space to separate tokens. [SingleSpaceSeparator]
[ERROR] \checkstyle\src\test\java\com\puppycrawl\tools\checkstyle\MainTest.java:634:51: Use a single space to separate tokens. [SingleSpaceSeparator]

Example:
https://github.com/checkstyle/checkstyle/blob/master/src/it/java/com/google/checkstyle/test/chapter4formatting/rule43onestatement/OneStatementPerLineTest.java#L83
Line 83 has 2 spaces between quote and +.
https://github.com/checkstyle/checkstyle/blob/master/src/test/java/com/puppycrawl/tools/checkstyle/api/AbstractCheckTest.java#L60
Line 60 has 2 spaces between return and CommonUtils.

When I run "mvn checkstyle:checkstyle" all I am getting is:

[INFO] ------------------------------------------------------------------------
[INFO] Building checkstyle 6.19-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-checkstyle-plugin:2.17:checkstyle (default-cli) @ checkstyle ---
[INFO] There are 3 errors reported by Checkstyle 6.18 with D:\Rickys\checkstyleWorkspaceEclipse\checkstyle/config/checkstyle_sevntu_checks.xml ruleset.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

@romani romani added the approved label May 13, 2016

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 13, 2016

Member

it is really strange why we have such problem, ... lets dig here .
All Sevntu Checks need to be enforced over Checkstyle code and be ready for move process(from sevntu-checkstyle to checkstyle).

Member

romani commented May 13, 2016

it is really strange why we have such problem, ... lets dig here .
All Sevntu Checks need to be enforced over Checkstyle code and be ready for move process(from sevntu-checkstyle to checkstyle).

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 15, 2016

Member

This Check will be problem for user who want to format their code by spaces on purpose - #1007

Member

romani commented May 15, 2016

This Check will be problem for user who want to format their code by spaces on purpose - #1007

rnveach added a commit to rnveach/checkstyle that referenced this issue May 15, 2016

rnveach added a commit to rnveach/checkstyle that referenced this issue May 15, 2016

rnveach added a commit to rnveach/checkstyle that referenced this issue May 15, 2016

rnveach added a commit to rnveach/checkstyle that referenced this issue May 26, 2016

rnveach added a commit to rnveach/checkstyle that referenced this issue May 27, 2016

romani added a commit that referenced this issue May 28, 2016

@romani romani added the new feature label May 28, 2016

@romani romani added this to the 6.19 milestone May 28, 2016

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 28, 2016

Member

fix is merged.

Member

romani commented May 28, 2016

fix is merged.

@romani romani closed this May 28, 2016

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani May 28, 2016

Member

checkstyle-tester is updated to reference new check - checkstyle/contribution@c1d68c8

Member

romani commented May 28, 2016

checkstyle-tester is updated to reference new check - checkstyle/contribution@c1d68c8

@romani romani changed the title from Sevntu CS: implement SingleSpaceSeparatorCheck to new Check: SingleSpaceSeparator May 29, 2016

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