See More

#!/usr/bin/env bash # # Copyright 2023 Red Hat # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # -------------------------------------------------- # # Validates the source code by applying # - maven-enforcer-plugin # - maven-checkstyle-plugin # - license-maven-plugin # - formatter-maven-plugin # - impsort-maven-plugin # # -------------------------------------------------- set -Eeuo pipefail trap cleanup SIGINT SIGTERM ERR EXIT VERSION=0.0.1 # Change into the script's directory # Using relative paths is safe! script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) readonly script_dir cd "${script_dir}" usage() { cat <&2 -e "${1-}" } die() { local msg=$1 local code=${2-1} # default exit status 1 msg "$msg" exit "$code" } version() { msg "${BASH_SOURCE[0]} $VERSION" exit 0 } parse_params() { while :; do case "${1-}" in -h | --help) usage ;; -v | --version) version ;; --no-color) NO_COLOR=1 ;; -?*) die "Unknown option: $1" ;; *) break ;; esac shift done return 0 } parse_params "$@" setup_colors mvn -P showcase \ org.apache.maven.plugins:maven-enforcer-plugin:enforce \ org.apache.maven.plugins:maven-checkstyle-plugin:check \ com.mycila:license-maven-plugin:check \ org.ec4j.maven:editorconfig-maven-plugin:check \ net.revelc.code:impsort-maven-plugin:check