Skip to content

Commit f6722cf

Browse files
committed
Update ESLint and Snyk scripts to suppress error output and improve logging
- Modified run_eslint.sh and run_snyk.sh to redirect error output to /dev/null, enhancing log cleanliness. - Ensured that failure messages are still logged to the main log file for transparency, while minimizing clutter during report generation.
1 parent 43c8a6b commit f6722cf

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

scripts/tools/run_eslint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ if command -v eslint &>/dev/null; then
3434

3535
# Run ESLint scan with JSON output
3636
# ESLint v9+ uses new flat config, skip config check with --no-config-lookup
37-
eslint --format=json --output-file="$ESLINT_JSON" "$TARGET_PATH" 2>&1 || {
37+
eslint --format=json --output-file="$ESLINT_JSON" "$TARGET_PATH" >/dev/null 2>&1 || {
3838
echo "[run_eslint.sh][ESLint] JSON report generation failed." >> "$LOG_FILE"
3939
echo '[]' > "$ESLINT_JSON"
4040
}
4141

4242
# Run ESLint scan with text output
43-
eslint --format=compact --output-file="$ESLINT_TEXT" "$TARGET_PATH" 2>&1 || {
43+
eslint --format=compact --output-file="$ESLINT_TEXT" "$TARGET_PATH" >/dev/null 2>&1 || {
4444
echo "[run_eslint.sh][ESLint] Text report generation failed." >> "$LOG_FILE"
4545
}
4646

scripts/tools/run_snyk.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ if command -v snyk &>/dev/null; then
4040

4141
# Run Snyk test with JSON output
4242
echo "[run_snyk.sh][Snyk] Running Snyk test with JSON output..." | tee -a "$LOG_FILE"
43-
snyk test $SNYK_AUTH_FLAG --json --output-file="$SNYK_JSON" 2>/dev/null || {
43+
snyk test $SNYK_AUTH_FLAG --json --output-file="$SNYK_JSON" >/dev/null 2>&1 || {
4444
echo "[run_snyk.sh][Snyk] JSON report generation failed, trying alternative approach..." | tee -a "$LOG_FILE"
4545

4646
# Try with different options
47-
snyk test $SNYK_AUTH_FLAG --json > "$SNYK_JSON" 2>/dev/null || {
47+
snyk test $SNYK_AUTH_FLAG --json > "$SNYK_JSON" 2>&1 || {
4848
echo "[run_snyk.sh][Snyk] Alternative JSON scan also failed, creating minimal report..." | tee -a "$LOG_FILE"
4949
echo '{"vulnerabilities": [], "summary": {"total_packages": 0, "vulnerable_packages": 0, "total_vulnerabilities": 0}, "error": "Snyk scan failed"}' > "$SNYK_JSON"
5050
}

0 commit comments

Comments
 (0)