Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Version 9.x Reports Whitespace Before Paren After String with Emojis #11001

Closed
alzimmermsft opened this issue Dec 4, 2021 · 5 comments · Fixed by #11004
Closed

Version 9.x Reports Whitespace Before Paren After String with Emojis #11001

alzimmermsft opened this issue Dec 4, 2021 · 5 comments · Fixed by #11004
Milestone

Comments

@alzimmermsft
Copy link

alzimmermsft commented Dec 4, 2021

I have read check documentation: https://checkstyle.org/config_whitespace.html#ParenPad
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words

/var/tmp $ javac Test.java

/var/tmp $ cat config.xml
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
  "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
  "https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
  <module name="TreeWalker">
    <module name="ParenPad"/>
  </module>
</module>

/var/tmp $ cat Test.java
public class Test {
    void emojiFamilyRunner(Consumer<String> testRunner, String text) {
        testRunner.accept("👩‍👩‍👧‍👧 " + text); // count as 12 units
    }

    void emojiFamilyWithSkinToneModifierRunner(Consumer<String> testRunner, String text) {
        testRunner.accept("👩🏻‍👩🏽‍👧🏾‍👦🏿 " + text); // count as 20 units
    }
}

/var/tmp $ RUN_LOCALE="-Duser.language=en -Duser.country=US"
/var/tmp $ java $RUN_LOCALE -jar checkstyle-9.2-all.jar -c config.xml Test.java
Starting audit...
[ERROR] C:\Users\Work\Documents\Playground\CheckstylePlayground\.\src\main\java\Test.java:8:44: ')' is preceded with whitespace. [ParenPad]
[ERROR] C:\Users\Work\Documents\Playground\CheckstylePlayground\.\src\main\java\Test.java:12:48: ')' is preceded with whitespace. [ParenPad]
Audit done.

For Windows users, please use type instead of cat and run

set RUN_LOCALE="-Duser.language=en -Duser.country=US"
java %RUN_LOCALE% -jar checkstyle-9.2-all.jar -c config.xml Test.java

in place of the last 2 commands above.


I would have expected no errors to be reported in this case but it appears the emoji messes up with where the paren is being seen. This doesn't occur when using 8.45.1.

This appears to be similar to #10920.

@romani
Copy link
Member

romani commented Dec 4, 2021

Series of emoji ticket, so much fun :)

@romani
Copy link
Member

romani commented Dec 4, 2021

@nmancus1

@nrmancuso
Copy link
Member

While this could be done in #10924, I think it is better to provide a quick fix for this issue since scope of #10924 just grew significantly and may not make it into next release.

@nrmancuso
Copy link
Member

I am on it.

nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 4, 2021
@strkkk strkkk added the bug label Dec 4, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 5, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 6, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 6, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 9, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 9, 2021
github-actions bot pushed a commit to nrmancuso/checkstyle that referenced this issue Dec 10, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 10, 2021
github-actions bot pushed a commit to nrmancuso/checkstyle that referenced this issue Dec 11, 2021
nrmancuso added a commit to nrmancuso/checkstyle that referenced this issue Dec 11, 2021
@romani romani added this to the 9.3 milestone Dec 11, 2021
@romani
Copy link
Member

romani commented Dec 11, 2021

Fix merged

rwalkerands added a commit to au-research/ANDS-ResearchVocabularies-Registry that referenced this issue Jul 11, 2022
While adding more test cases for CC-2905 using multibyte characters, I
found that I encountered this issue:

checkstyle/checkstyle#11001

So upgrade Checkstyle to release 9.3, which fixes it.

SD-1540906
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants