Skip to content

Commit 8e9e8b9

Browse files
committed
added missing files
1 parent 0cb5e79 commit 8e9e8b9

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

scripts/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# uv virtual environment
2+
.venv

scripts/run_sonar_scan.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Resolve the project root directory (assuming this script is inside the 'scripts' folder)
4+
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
ENV_FILE="$PROJECT_ROOT/.env"
6+
7+
# Check if .env file exists
8+
if [ ! -f "$ENV_FILE" ]; then
9+
echo "Error: .env file not found at $ENV_FILE"
10+
exit 1
11+
fi
12+
13+
# Extract SONAR_TOKEN from .env
14+
# This looks for the key, splits by =, removes quotes (single or double), and removes Windows carriage returns
15+
SONAR_TOKEN=$(grep "^SONAR_TOKEN=" "$ENV_FILE" | cut -d'=' -f2- | tr -d '"' | tr -d "'" | tr -d '\r')
16+
17+
if [ -z "$SONAR_TOKEN" ]; then
18+
echo "Error: SONAR_TOKEN not found or empty in .env file."
19+
exit 1
20+
fi
21+
22+
# Navigate to project root, install dependencies, run tests, and then the sonar-scanner
23+
cd "$PROJECT_ROOT" || exit
24+
echo "Installing dependencies..."
25+
npm install
26+
echo "Running tests and generating coverage..."
27+
npm test
28+
echo "Running SonarQube analysis..."
29+
npm exec sonar-scanner -- \
30+
-Dsonar.organization=rohithandique \
31+
-Dsonar.projectKey=rohithandique_generic-ui-react \
32+
-Dsonar.token="$SONAR_TOKEN"

0 commit comments

Comments
 (0)