Skip to content

Commit

Permalink
YETUS-749. change findbugs to spotbugs
Browse files Browse the repository at this point in the history
  • Loading branch information
aw-was-here committed Mar 19, 2019
1 parent bdb0f18 commit 3d5f644
Show file tree
Hide file tree
Showing 16 changed files with 233 additions and 148 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ pipeline {
YETUS_ARGS+=(--proclimit=2000)
# rsync these files back into the archive dir
YETUS_ARGS+=("--archive-list=checkstyle-errors.xml,findbugsXml.xml")
YETUS_ARGS+=("--archive-list=checkstyle-errors.xml,spotbugsXml.xml")
# URL for user-side presentation in reports and such to our artifacts
# (needs to match the archive bits below)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ Language Support, Licensing, and more:
* [Apache Creadur Rat](http://creadur.apache.org/rat/) entries in build system
* [checkstyle](http://checkstyle.sourceforge.net/) entries in build system (ant and maven only)
* [FindBugs](http://findbugs.sourceforge.net/) entries in build system and 3.x executables
(NOTE: FindBugs executables are required even if the build system is using [Spotbugs](https://spotbugs.github.io/))
- NOTE: only one of FindBugs or SpotBugs may be used at a time.
* [SpotBugs](https://spotbugs.github.io/)) entries in build system and 3.x executables
- NOTE: only one of FindBugs or SpotBugs may be used at a time.
* [jshint](https://jshint.com) installed
* [hadolint](https://github.com/hadolint/hadolint) installed
* [Perl::Critic](http://perlcritic.com/) installed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public static void validOptions(String[][] options,
case STABLE_OPTION:
RootDocProcessor.stability = STABLE_OPTION;
break;
default:
break;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<jython-shaded.version>2.7.1</jython-shaded.version>
<maven-checkstyle-plugin.version>3.0.0</maven-checkstyle-plugin.version>
<maven-project-info-reports-plugin.version>3.0.0</maven-project-info-reports-plugin.version>
<spotbugs-maven-plugin.version>3.1.7</spotbugs-maven-plugin.version>
<spotbugs-maven-plugin.version>3.1.11</spotbugs-maven-plugin.version>

<sourceReleaseAssemblyDescriptor>source-release-tar</sourceReleaseAssemblyDescriptor>

Expand Down
30 changes: 27 additions & 3 deletions precommit/src/main/shell/core.d/01-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,11 @@ function verify_plugin_enabled
declare strip
declare stridx

yetus_debug "Testing if $1 has been enabled by user"
yetus_debug "Testing if ${toadd} has been enabled by user"

bar=""
for idx in ${ENABLED_PLUGINS}; do
stridx=${idx// }
yetus_debug "verify_plugin_enabled: processing ${stridx}"
case ${stridx} in
all)
bar=${toadd}
Expand All @@ -343,7 +342,9 @@ function verify_plugin_enabled
done

if [[ -n ${bar} ]]; then
yetus_debug "Post-parsing: checking ${bar} = ${toadd}"
if [[ "${bar}" = "${toadd}" ]]; then
yetus_debug "Post-parsing: ${toadd} enabled"
fi
fi
[[ ${bar} = "${toadd}" ]]
}
Expand Down Expand Up @@ -418,6 +419,23 @@ function delete_test_type
yetus_del_array_element TESTTYPES "${1}"
}

## @description Add the given test type
## @audience public
## @stability stable
## @replaceable yes
## @param plugin
function replace_test_type
{
if verify_plugin_enabled "${1}" && verify_plugin_enabled "${2}"; then
yetus_error "WARNING: $2 has been replaced with $1. Disabling $2."
ENABLED_PLUGINS=${ENABLED_PLUGINS%$2}
delete_test_type "$2"
delete_test "$2"
return 0
fi
return 1
}

## @description Add the given bugsystem type
## @audience public
## @stability stable
Expand Down Expand Up @@ -536,6 +554,12 @@ function importplugins
fi
done

for i in "${TESTTYPES[@]}"; do
if declare -f "${i}_deprecate_test_type" >/dev/null; then
"${i}_deprecate_test_type"
fi
done

if [[ ${ROBOT} == true ]]; then
if declare -f "${ROBOTTYPE}"_set_plugin_defaults >/dev/null; then
"${ROBOTTYPE}"_set_plugin_defaults
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/it/it-tp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fi
# our 'default' args, in (mostly) alphabetical order

# rsync these files back into the archive dir
YETUS_ARGS+=("--archive-list=checkstyle-errors.xml,findbugsXml.xml")
YETUS_ARGS+=("--archive-list=checkstyle-errors.xml,spotbugsXml.xml")

# where the source is located
YETUS_ARGS+=("--basedir=${BASEDIR}")
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/personality/hadoop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# SHELLDOC-IGNORE
#
# Override these to match Apache Hadoop's requirements
personality_plugins "all,-ant,-gradle,-scalac,-scaladoc"
personality_plugins "all,-ant,-gradle,-scalac,-scaladoc,-spotbugs"

## @description Globals specific to this personality
## @audience private
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/personality/hbase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

personality_plugins "all"
personality_plugins "all,-spotbugs"

## @description Globals specific to this personality
## @audience private
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/personality/jmeter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

personality_plugins "all,-javadoc,-findbugs,-asflicense"
personality_plugins "all,-javadoc,-findbugs,-asflicense,-spotbugs"

## @description Globals specific to this personality
## @audience private
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/personality/orc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

personality_plugins "all,-checkstyle,-findbugs"
personality_plugins "all,-checkstyle,-findbugs,-spotbugs"

## @description Globals specific to this personality
## @audience private
Expand Down
2 changes: 1 addition & 1 deletion precommit/src/main/shell/personality/pig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

personality_plugins "all"
personality_plugins "all,-spotbugs"

## @description Globals specific to this personality
## @audience private
Expand Down
12 changes: 12 additions & 0 deletions precommit/src/main/shell/test-patch-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ RUN apt-get -q update && apt-get -q install --no-install-recommends -y findbugs
&& rm -rf /var/lib/apt/lists/*
ENV FINDBUGS_HOME /usr

#####
# Install SpotBugs
#####
RUN curl -fsSL http://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/3.1.12/spotbugs-3.1.12.tgz -o spotbugs.tgz \
&& curl -fsSL http://repo.maven.apache.org/maven2/com/github/spotbugs/spotbugs/3.1.12/spotbugs-3.1.12.tgz.sha1 -o spotbugs.tgz.sha1 \
&& echo -n " spotbugs.tgz" >> spotbugs.tgz.sha1 \
&& shasum -c spotbugs.tgz.sha1 \
&& mkdir -p /opt/spotbugs \
&& tar -C /opt/spotbugs --strip-components 1 -xpf spotbugs.tgz \
&& rm spotbugs.tgz spotbugs.tgz.sha1
ENV SPOTBUGS_HOME /opt/spotbugs

####
# Install GNU C/C++
####
Expand Down
4 changes: 4 additions & 0 deletions precommit/src/main/shell/test-patch.d/ant.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ function ant_modules_worker
javadoc)
modules_workers "${repostatus}" javadoc clean javadoc
;;
spotbugs)
modules_workers "${repostatus}" spotbugs spotbugs
;;
unit)
modules_workers "${repostatus}" unit
;;
Expand Down Expand Up @@ -209,6 +212,7 @@ function ant_builtin_personality_file_tests
fi

if [[ ${filename} =~ \.java$ ]]; then
add_test spotbugs
add_test findbugs
fi
}
Expand Down
1 change: 1 addition & 0 deletions precommit/src/main/shell/test-patch.d/gradle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ function gradle_builtin_personality_file_tests
fi

if [[ ${filename} =~ \.java$ ]]; then
add_test spotbugs
add_test findbugs
fi
}
Expand Down
7 changes: 6 additions & 1 deletion precommit/src/main/shell/test-patch.d/maven.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ function maven_modules_worker
scaladoc)
modules_workers "${repostatus}" scaladoc clean scala:doc -DskipTests=true
;;
spotbugs)
modules_workers "${repostatus}" spotbugs test-compile spotbugs:spotbugs -DskipTests=true
;;
unit)
if [[ -n "${maven_unit_test_filter}" ]]; then
modules_workers "${repostatus}" unit clean test -fae "${maven_unit_test_filter}"
Expand Down Expand Up @@ -525,6 +528,7 @@ function maven_builtin_personality_file_tests
fi

if [[ ${filename} =~ \.java$ ]]; then
add_test spotbugs
add_test findbugs
fi
}
Expand Down Expand Up @@ -629,7 +633,8 @@ function maven_precompile
modules_workers "${repostatus}" mvninstall -fae \
clean install \
-DskipTests=true -Dmaven.javadoc.skip=true \
-Dcheckstyle.skip=true -Dfindbugs.skip=true
-Dcheckstyle.skip=true -Dfindbugs.skip=true \
-Dspotbugs.skip=true
result=$?
modules_messages "${repostatus}" mvninstall true
if [[ ${result} != 0 ]]; then
Expand Down

0 comments on commit 3d5f644

Please sign in to comment.