M3 Security Fixes for scan command pass 32 moved scan.sh
This commit is contained in:
@@ -3,7 +3,11 @@ set -euo pipefail
|
||||
|
||||
SONAR_URL="http://192.168.1.2:9001"
|
||||
PROJECT="Warehouse-Management-System"
|
||||
OUTPUT="sonarqube-issues.csv"
|
||||
|
||||
# The directory scan.sh was invoked from is the project root.
|
||||
PROJECT_DIR="$PWD"
|
||||
OUTPUT="$PROJECT_DIR/sonarqube-issues.csv"
|
||||
|
||||
TMP=$(mktemp)
|
||||
|
||||
trap 'rm -f "$TMP" "$TMP.new"' EXIT
|
||||
@@ -13,13 +17,21 @@ if [ -z "${SONAR_TOKEN:-}" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete previous report FIRST
|
||||
if [ ! -d "$PROJECT_DIR" ]; then
|
||||
echo "ERROR: Project directory does not exist: $PROJECT_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Delete previous report FIRST.
|
||||
echo "Removing previous SonarQube report..."
|
||||
rm -f "$OUTPUT"
|
||||
|
||||
echo
|
||||
echo "Project directory: $PROJECT_DIR"
|
||||
echo "Running SonarQube scan..."
|
||||
|
||||
cd "$PROJECT_DIR"
|
||||
|
||||
JAVA_HOME="/opt/homebrew/opt/openjdk" \
|
||||
PATH="/opt/homebrew/opt/openjdk/bin:$PATH" \
|
||||
sonar-scanner \
|
||||
Reference in New Issue
Block a user