Skip to content

Commit 588a2d6

Browse files
committed
Merge branch 'gh74_findbugs'
Scan sources by FindBugs. Fix #74
2 parents ff0ec21 + 0a548dc commit 588a2d6

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

pom.xml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,8 @@
393393
<enforcer.plugin.version>1.4.1</enforcer.plugin.version>
394394
<failsafe.plugin.version>2.19.1</failsafe.plugin.version>
395395
<fest.assert.version>2.0M8</fest.assert.version>
396+
<findbugs.excludeFilterFile>src/main/config/findbugs-filter.xml</findbugs.excludeFilterFile>
397+
<findbugs.plugin.version>3.0.4</findbugs.plugin.version>
396398
<gmaven.plugin.version>1.4</gmaven.plugin.version>
397399
<gmaven.runtime.plugin.version>1.5</gmaven.runtime.plugin.version>
398400

@@ -756,6 +758,19 @@
756758
</configuration>
757759
</plugin>
758760

761+
<!--
762+
Usage:
763+
mvn findbugs:check (checks the sources and produces report to the console)
764+
-->
765+
<plugin>
766+
<groupId>org.codehaus.gmaven</groupId>
767+
<artifactId>findbugs-maven-plugin</artifactId>
768+
<version>${findbugs.plugin.version}</version>
769+
<configuration>
770+
<includeTests>true</includeTests>
771+
</configuration>
772+
</plugin>
773+
759774
<plugin>
760775
<groupId>org.codehaus.gmaven</groupId>
761776
<artifactId>gmaven-plugin</artifactId>

src/main/config/findbugs-filter.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<FindBugsFilter>
2+
<Match>
3+
<!--
4+
Our DTO classes expose it's internal representation.
5+
Most of the time because they're using Date class and
6+
storing data in byte[].
7+
-->
8+
<Class name="~.*\.dto\..*" />
9+
<Bug pattern="EI_EXPOSE_REP,EI_EXPOSE_REP2" />
10+
</Match>
11+
<Match>
12+
<!--
13+
It's ok, that we're don't override parent's equals() method.
14+
-->
15+
<Class name="ru.mystamps.web.support.spring.security.CustomUserDetails" />
16+
<Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS" />
17+
</Match>
18+
</FindBugsFilter>

src/main/scripts/ci/check-build-and-verify.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ BOOTLINT_FAIL=
1616
JASMINE_FAIL=
1717
HTML_FAIL=
1818
TEST_FAIL=
19+
FINDBUGS_FAIL=
1920
VERIFY_FAIL=
2021

2122
if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
@@ -41,6 +42,8 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
4142
--show-warnings \
4243
>validator.log 2>&1 || HTML_FAIL=yes
4344
mvn --batch-mode test -Denforcer.skip=true -DskipMinify=true >test.log 2>&1 || TEST_FAIL=yes
45+
# run after tests for getting compiled sources
46+
mvn --batch-mode findbugs:check >findbugs.log 2>&1 || FINDBUGS_FAIL=yes
4447
fi
4548

4649
mvn --batch-mode verify -Denforcer.skip=true -DskipUnitTests=true >verify.log 2>&1 || VERIFY_FAIL=yes
@@ -59,6 +62,7 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
5962
print_status "$JASMINE_FAIL" 'Run JavaScript unit tests'
6063
print_status "$HTML_FAIL" 'Run html5validator'
6164
print_status "$TEST_FAIL" 'Run unit tests'
65+
print_status "$FINDBUGS_FAIL" 'Run FindBugs'
6266
fi
6367

6468
print_status "$VERIFY_FAIL" 'Run integration tests'
@@ -75,12 +79,13 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
7579
print_log jasmine.log 'Run JavaScript unit tests'
7680
print_log validator.log 'Run html5validator'
7781
print_log test.log 'Run unit tests'
82+
print_log findbugs.log 'Run FindBugs'
7883
fi
7984

8085
print_log verify.log 'Run integration tests'
8186

82-
rm -f cs.log pmd.log codenarc.log license.log bootlint.log jasmine.log validator.log test.log verify.log
87+
rm -f cs.log pmd.log codenarc.log license.log bootlint.log jasmine.log validator.log test.log findbugs.log verify.log
8388

84-
if [ -n "$CS_FAIL$PMD_FAIL$CODENARC_FAIL$LICENSE_FAIL$POM_FAIL$BOOTLINT_FAIL$JASMINE_FAIL$HTML_FAIL$TEST_FAIL$VERIFY_FAIL" ]; then
89+
if [ -n "$CS_FAIL$PMD_FAIL$CODENARC_FAIL$LICENSE_FAIL$POM_FAIL$BOOTLINT_FAIL$JASMINE_FAIL$HTML_FAIL$TEST_FAIL$FINDBUGS_FAIL$VERIFY_FAIL" ]; then
8590
exit 1
8691
fi

0 commit comments

Comments
 (0)