Skip to content

Commit

Permalink
regex as exclude for findbug
Browse files Browse the repository at this point in the history
  • Loading branch information
alevohin committed Jan 2, 2015
1 parent fe210bd commit 9af9f60
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 4 deletions.
2 changes: 1 addition & 1 deletion qulice-maven-plugin/src/it/findbugs-exclude/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<excludes>
<!-- @todo #352 Need to add multiline check after issue #350-->
<!-- resolved. Now only one class can be excluded -->
<exclude>findbugs:com.qulice.foo.Main</exclude>
<exclude>findbugs:~com.qulice.foo.*</exclude>
</excludes>
</configuration>
<executions>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* This project has a license.
*/
package com.qulice.foo;

import java.net.URL;
import java.util.HashSet;
import java.util.Set;

/**
* This is just a test class.
* @author Yuriy Alevohin (alevohin@mail.ru)
* @version $Id$
*/
public final class Bar {

/**
* List of some URLs.
*/
private final transient Set<URL> list;

/**
* Test something.
*/
public Bar() {
this.list = new HashSet<URL>();
}

/**
* Get size of list.
* @return The size
*/
public int size() {
return this.list.size();
}

}
1 change: 1 addition & 0 deletions qulice-maven-plugin/src/it/findbugs-exclude/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@
*/
def log = new File(basedir, 'build.log')
assert !log.text.contains('com.qulice.foo.Main.list is or uses a map or set of URLs, which can be a performance hog')
assert !log.text.contains('com.qulice.foo.Bar.list is or uses a map or set of URLs, which can be a performance hog')
7 changes: 4 additions & 3 deletions qulice-maven-plugin/src/site/apt/example-exclude.apt.vm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Exclude
<configuration>
<excludes>
<exclude>checkstyle:/src/examples/.*</exclude>
<exclude>findbugs:com.qulice.foo.Main</exclude>
<exclude>findbugs:~com.qulice.foo.*</exclude>
</excludes>
</configuration>
</plugin>
Expand All @@ -72,6 +72,7 @@ Exclude
2) <<<codenarc:**/src/ex1/Main.groovy,**/src/ex2/Main2.groovy>>> excludes
<<<Main.groovy>>> and <<<Main2.groovy>>> in appropriate packages.

Exclude for Findbug is a bit different, as expression must be exact class name.
See http://findbugs.sourceforge.net/manual/filter.html
Exclude for Findbug is a bit different, as expression must be exact class name
or starts with the ~ character the rest of content is interpreted as
a Java regular expression. See http://findbugs.sourceforge.net/manual/filter.html
Only one exclude is supported for findbugs.

0 comments on commit 9af9f60

Please sign in to comment.