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

ForbidCertainImportsCheck: null excludes gives no violations #552

Closed
rnveach opened this Issue Dec 8, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@rnveach
Contributor

rnveach commented Dec 8, 2016

$ cat TestClass.java
package com.github.sevntu.checkstyle.checks.coding;

import com.puppycrawl.tools.checkstyle.api.AutomaticBean; // forbidden

public class InputForbidsCertainImports
{
    public int a()
    {
        
        AutomaticBean smth = new com.puppycrawl.tools.checkstyle.api.AutomaticBean(); // forbidden!
        return 5;
    }
}


$ cat TestConfig.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="com.github.sevntu.checkstyle.checks.coding.ForbidCertainImportsCheck">
<property name="packageNameRegexp" value=".+\.sevntu\..+"/>
<property name="forbiddenImportsRegexp" value=".+\.api\..+"/>
</module>
    </module>
</module>

$ java -classpath sevntu-checks-1.22.0.jar;checkstyle-7.3-all.jar com.puppycrawl.tools.checkstyle.Main -c TestConfig.xml TestClass.java
Starting audit...
Audit done.

Issue only presents itself when no forbiddenImportsExcludesRegexp is given. Once it is set, 2 violations show up for lines 3 and 10.
It makes no sense that no exclusions would prevent any violations from showing.

rnveach added a commit to rnveach/sevntu.checkstyle that referenced this issue Dec 8, 2016

rnveach added a commit to rnveach/sevntu.checkstyle that referenced this issue Dec 8, 2016

rnveach added a commit to rnveach/sevntu.checkstyle that referenced this issue Dec 8, 2016

@romani romani added this to the 1.23 milestone Dec 8, 2016

@romani

This comment has been minimized.

Show comment
Hide comment
@romani

romani Dec 8, 2016

Member

fix is merged

Member

romani commented Dec 8, 2016

fix is merged

@romani romani closed this Dec 8, 2016

kariem added a commit to kariem/sevntu.checkstyle that referenced this issue Jul 26, 2018

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