Skip to content

Commit d1c5b77

Browse files

File tree

4 files changed

+39
-32
lines changed

4 files changed

+39
-32
lines changed

Dangerfile

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ unless test_reports.empty?
567567
print_errors_summary 'maven-surefire-plugin', errors_count, 'https://github.com/php-coder/mystamps/wiki/unit-tests'
568568
end
569569

570-
# Handle `mvn findbugs:check` results
570+
# Handle `mvn spotbugs:check` results
571571
#
572572
# Example:
573573
# <BugCollection sequence="0" release="" analysisTimestamp="1489272156067" version="3.0.1" # timestamp="1489272147000">
@@ -583,10 +583,10 @@ end
583583
# </BugInstance>
584584
# </BugCollection>
585585
#
586-
findbugs_report = 'target/findbugsXml.xml'
587-
if File.file?(findbugs_report)
586+
spotbugs_report = 'target/spotbugsXml.xml'
587+
if File.file?(spotbugs_report)
588588
errors_count = 0
589-
doc = Nokogiri::XML(File.open(findbugs_report))
589+
doc = Nokogiri::XML(File.open(spotbugs_report))
590590
src_dirs = doc.xpath('//SrcDir').map { |node| node.text }
591591
doc.xpath('//BugInstance').each do |node|
592592
errors_count += 1
@@ -602,9 +602,10 @@ if File.file?(findbugs_report)
602602
src_dir = src_dirs.find { |dir| File.file?("#{dir}/#{file}") }
603603
src_dir = src_dir.sub(pwd, '')
604604
file = github.html_link("#{src_dir}/#{file}#{line}")
605-
fail("findbugs-maven-plugin error in #{file}:\n#{msg}")
605+
fail("spotbugs-maven-plugin error in #{file}:\n#{msg}")
606606
end
607-
print_errors_summary 'findbugs-maven-plugin', errors_count, 'https://github.com/php-coder/mystamps/wiki/findbugs'
607+
# FIXME: add a link to the SpotBugs documentation
608+
print_errors_summary 'spotbugs-maven-plugin', errors_count
608609
end
609610

610611
# Handle `mvn robotframework:run` report

pom.xml

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,6 @@
497497
<error-prone.version>2.3.2</error-prone.version>
498498
<failsafe.plugin.version>2.22.0</failsafe.plugin.version>
499499
<fest.assert.version>2.0M8</fest.assert.version>
500-
<findbugs.excludeFilterFile>src/main/config/findbugs-filter.xml</findbugs.excludeFilterFile>
501-
<findbugs.plugin.version>3.0.5</findbugs.plugin.version>
502500
<gmavenplus.plugin.version>1.5</gmavenplus.plugin.version>
503501

504502
<!-- Redefine default value from spring-boot-dependencies (https://github.com/spring-projects/spring-boot/blob/v1.5.20.RELEASE/spring-boot-dependencies/pom.xml) -->
@@ -580,6 +578,8 @@
580578
<!-- Redefine default value from spring-boot-dependencies (https://github.com/spring-projects/spring-boot/blob/v1.5.20.RELEASE/spring-boot-dependencies/pom.xml) -->
581579
<spock.version>1.0-groovy-2.0</spock.version>
582580

581+
<spotbugs.plugin.version>3.1.11</spotbugs.plugin.version>
582+
583583
<!-- Define default value for spring-boot-starter-parent (https://github.com/spring-projects/spring-boot/blob/v1.5.20.RELEASE/spring-boot-starters/spring-boot-starter-parent/pom.xml) -->
584584
<start-class>ru.mystamps.web.support.spring.boot.ApplicationBootstrap</start-class>
585585

@@ -665,6 +665,20 @@
665665
</configuration>
666666
</plugin>
667667

668+
<!--
669+
Usage:
670+
mvn spotbugs:check (checks the sources and produces report to the console)
671+
-->
672+
<plugin>
673+
<groupId>com.github.spotbugs</groupId>
674+
<artifactId>spotbugs-maven-plugin</artifactId>
675+
<version>${spotbugs.plugin.version}</version>
676+
<configuration>
677+
<includeTests>true</includeTests>
678+
<excludeFilterFile>src/main/config/spotbugs-filter.xml</excludeFilterFile>
679+
</configuration>
680+
</plugin>
681+
668682
<plugin>
669683
<groupId>com.mycila</groupId>
670684
<artifactId>license-maven-plugin</artifactId>
@@ -971,19 +985,6 @@
971985
</configuration>
972986
</plugin>
973987

974-
<!--
975-
Usage:
976-
mvn findbugs:check (checks the sources and produces report to the console)
977-
-->
978-
<plugin>
979-
<groupId>org.codehaus.mojo</groupId>
980-
<artifactId>findbugs-maven-plugin</artifactId>
981-
<version>${findbugs.plugin.version}</version>
982-
<configuration>
983-
<includeTests>true</includeTests>
984-
</configuration>
985-
</plugin>
986-
987988
<plugin>
988989
<groupId>org.codehaus.mojo</groupId>
989990
<artifactId>native2ascii-maven-plugin</artifactId>

src/main/config/findbugs-filter.xml renamed to src/main/config/spotbugs-filter.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
<FindBugsFilter>
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<FindBugsFilter
3+
xmlns="https://github.com/spotbugs/filter/3.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="https://github.com/spotbugs/filter/3.0.0 https://raw.githubusercontent.com/spotbugs/spotbugs/3.1.0/spotbugs/etc/findbugsfilter.xsd">
6+
27
<Match>
38
<!--
49
Our DTO classes expose it's internal representation.

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ HTML_STATUS=
3030
ENFORCER_STATUS=
3131
TEST_STATUS=
3232
CODENARC_STATUS=
33-
FINDBUGS_STATUS=
33+
SPOTBUGS_STATUS=
3434
VERIFY_STATUS=
3535

3636
DANGER_STATUS=skip
@@ -56,7 +56,7 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
5656
AFFECTS_POM_XML="$(echo "$MODIFIED_FILES" | grep -Fxq 'pom.xml' || echo 'no')"
5757
AFFECTS_TRAVIS_CFG="$(echo "$MODIFIED_FILES" | grep -Fxq '.travis.yml' || echo 'no')"
5858
AFFECTS_CS_CFG="$(echo "$MODIFIED_FILES" | grep -Eq '(checkstyle\.xml|checkstyle-suppressions\.xml)$' || echo 'no')"
59-
AFFECTS_FB_CFG="$(echo "$MODIFIED_FILES" | grep -q 'findbugs-filter\.xml$' || echo 'no')"
59+
AFFECTS_SPOTBUGS_CFG="$(echo "$MODIFIED_FILES" | grep -q 'spotbugs-filter\.xml$' || echo 'no')"
6060
AFFECTS_PMD_XML="$(echo "$MODIFIED_FILES" | grep -q 'pmd\.xml$' || echo 'no')"
6161
AFFECTS_JS_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.js$' || echo 'no')"
6262
AFFECTS_HTML_FILES="$(echo "$MODIFIED_FILES" | grep -q '\.html$' || echo 'no')"
@@ -72,7 +72,7 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
7272
ENFORCER_STATUS=skip
7373

7474
if [ "$AFFECTS_JAVA_FILES" = 'no' ]; then
75-
[ "$AFFECTS_FB_CFG" != 'no' ] || FINDBUGS_STATUS=skip
75+
[ "$AFFECTS_SPOTBUGS_CFG" != 'no' ] || SPOTBUGS_STATUS=skip
7676
[ "$AFFECTS_PMD_XML" != 'no' ] || PMD_STATUS=skip
7777

7878
if [ "$AFFECTS_CS_CFG" = 'no' ] && [ "$AFFECTS_PROPERTIES" = 'no' ]; then
@@ -212,12 +212,12 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
212212
fi
213213
print_status "$CODENARC_STATUS" 'Run CodeNarc'
214214

215-
if [ "$FINDBUGS_STATUS" != 'skip' ]; then
215+
if [ "$SPOTBUGS_STATUS" != 'skip' ]; then
216216
# run after tests for getting compiled sources
217-
mvn --batch-mode findbugs:check \
218-
>findbugs.log 2>&1 || FINDBUGS_STATUS=fail
217+
mvn --batch-mode spotbugs:check \
218+
>spotbugs.log 2>&1 || SPOTBUGS_STATUS=fail
219219
fi
220-
print_status "$FINDBUGS_STATUS" 'Run FindBugs'
220+
print_status "$SPOTBUGS_STATUS" 'Run SpotBugs'
221221
fi
222222

223223
mvn --batch-mode verify -Denforcer.skip=true -DskipUnitTests=true \
@@ -246,7 +246,7 @@ if [ "$RUN_ONLY_INTEGRATION_TESTS" = 'no' ]; then
246246
[ "$ENFORCER_STATUS" = 'skip' ] || print_log enforcer.log 'Run maven-enforcer-plugin'
247247
[ "$TEST_STATUS" = 'skip' ] || print_log test.log 'Run unit tests'
248248
[ "$CODENARC_STATUS" = 'skip' ] || print_log codenarc.log 'Run CodeNarc'
249-
[ "$FINDBUGS_STATUS" = 'skip' ] || print_log findbugs.log 'Run FindBugs'
249+
[ "$SPOTBUGS_STATUS" = 'skip' ] || print_log spotbugs.log 'Run SpotBugs'
250250
fi
251251

252252
print_log verify.log 'Run integration tests'
@@ -255,8 +255,8 @@ if [ "$DANGER_STATUS" != 'skip' ]; then
255255
print_log danger.log 'Run danger'
256256
fi
257257

258-
rm -f cs.log pmd.log license.log pom.log bootlint.log rflint.log shellcheck.log jasmine.log validator.log enforcer.log test.log codenarc.log findbugs.log verify-raw.log verify.log danger.log
258+
rm -f cs.log pmd.log license.log pom.log bootlint.log rflint.log shellcheck.log jasmine.log validator.log enforcer.log test.log codenarc.log spotbugs.log verify-raw.log verify.log danger.log
259259

260-
if echo "$CS_STATUS$PMD_STATUS$LICENSE_STATUS$POM_STATUS$BOOTLINT_STATUS$RFLINT_STATUS$SHELLCHECK_STATUS$JASMINE_STATUS$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$CODENARC_STATUS$FINDBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS" | grep -Fqs 'fail'; then
260+
if echo "$CS_STATUS$PMD_STATUS$LICENSE_STATUS$POM_STATUS$BOOTLINT_STATUS$RFLINT_STATUS$SHELLCHECK_STATUS$JASMINE_STATUS$HTML_STATUS$ENFORCER_STATUS$TEST_STATUS$CODENARC_STATUS$SPOTBUGS_STATUS$VERIFY_STATUS$DANGER_STATUS" | grep -Fqs 'fail'; then
261261
exit 1
262262
fi

0 commit comments

Comments
 (0)