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

NoLineWrap: add support for static imports #3892

Closed
kukreja-vikramaditya opened this issue Mar 1, 2017 · 3 comments
Closed

NoLineWrap: add support for static imports #3892

kukreja-vikramaditya opened this issue Mar 1, 2017 · 3 comments

Comments

@kukreja-vikramaditya
Copy link
Contributor

kukreja-vikramaditya commented Mar 1, 2017

$ cat config.xml 
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
          "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
          "http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<module name="Checker">
    <property name="charset" value="UTF-8"/>
        <module name="TreeWalker">
             <module name="NoLineWrap">
        </module>
    </module>
</module>


$ cat Main.java 
import
static
   java
   .math
   .BigInteger
   .ONE;                 //Should show violation for IMPORT

import java.math.BigInteger;

public final class Main {
  public static void main(String... args) {
    BigInteger max = ONE;
  }
}

$ java -jar checkstyle-7.6-all.jar -c config.xml Main.java
Starting audit...
Audit done.

I expect an error during audit process like the google guidelines mentioned here. But the NoLineWrap is unable to figure this. If static keyword is removed, audit prints the expected result.

@kukreja-vikramaditya kukreja-vikramaditya changed the title False positive in False positive in static import check Mar 1, 2017
@kukreja-vikramaditya kukreja-vikramaditya changed the title False positive in static import check False positive in NoLineWrap Check for static imports Mar 1, 2017
@MEZk
Copy link
Contributor

MEZk commented Mar 2, 2017

@kukreja-vikramaditya
Please, add Checkstyle configuration only for NoLineWrap check into issue description.
Good PR example #3775
Tool: http://rveach.no-ip.org/checkstyle/checkstyle.php

@rnveach
Copy link
Member

rnveach commented Mar 2, 2017

@romani The issue looks valid to me.
http://checkstyle.sourceforge.net/config_whitespace.html#NoLineWrap
We already have IMPORT token, and description says we will verify import statements.

It seems we are just missing the STATIC_IMPORT token in acceptable and default.

@rnveach
Copy link
Member

rnveach commented Mar 19, 2017

Fix is merged

@rnveach rnveach closed this as completed Mar 19, 2017
@rnveach rnveach added this to the 7.7 milestone Mar 19, 2017
SergeyDzyuba pushed a commit to SergeyDzyuba/checkstyle that referenced this issue Mar 22, 2017
GitToasterhub pushed a commit to GitToasterhub/checkstyle that referenced this issue Mar 26, 2017
@romani romani changed the title False positive in NoLineWrap Check for static imports NoLineWrap: no support for static imports Mar 28, 2017
@romani romani changed the title NoLineWrap: no support for static imports NoLineWrap: add support for static imports Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants