Skip to content

Commit b9ee68e

Browse files
committed
fixed sonar issues
1 parent 8e9e8b9 commit b9ee68e

2 files changed

Lines changed: 7 additions & 6 deletions

File tree

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,5 @@ dist-ssr
2424
*.sw?
2525

2626
coverage/
27-
**/.env
27+
**/.env
28+
.scannerwork/

scripts/run_sonar_scan.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,24 @@ PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
55
ENV_FILE="$PROJECT_ROOT/.env"
66

77
# Check if .env file exists
8-
if [ ! -f "$ENV_FILE" ]; then
9-
echo "Error: .env file not found at $ENV_FILE"
8+
if [[ ! -f "$ENV_FILE" ]]; then
9+
echo "Error: .env file not found at $ENV_FILE" >&2
1010
exit 1
1111
fi
1212

1313
# Extract SONAR_TOKEN from .env
1414
# This looks for the key, splits by =, removes quotes (single or double), and removes Windows carriage returns
1515
SONAR_TOKEN=$(grep "^SONAR_TOKEN=" "$ENV_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'" | tr -d '\r')
1616

17-
if [ -z "$SONAR_TOKEN" ]; then
18-
echo "Error: SONAR_TOKEN not found or empty in .env file."
17+
if [[ -z "$SONAR_TOKEN" ]]; then
18+
echo "Error: SONAR_TOKEN not found or empty in .env file." >&2
1919
exit 1
2020
fi
2121

2222
# Navigate to project root, install dependencies, run tests, and then the sonar-scanner
2323
cd "$PROJECT_ROOT" || exit
2424
echo "Installing dependencies..."
25-
npm install
25+
npm install --ignore-scripts
2626
echo "Running tests and generating coverage..."
2727
npm test
2828
echo "Running SonarQube analysis..."

0 commit comments

Comments
 (0)