Agent-Hellboy / Agent-Hellboy/gunicorn-prometheus-exporter

Add ShellCheck to CI and pre-commit hooks

Offen
#90 1 Kommentar 0 Reaktionen 1 zugewiesene Person Beansprucht von @nXtCyberNet Auf GitHub ansehen
good first issue
Vorherrschende Sprache
Python
Sterne
18
Forks
1
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Overview

Add ShellCheck static analysis to CI workflows and pre-commit hooks to catch shell script issues early in the development process.

## Background

During review of PR #82, several ShellCheck warnings and errors were identified in the system test scripts:

### Current ShellCheck Findings in `system-test/system_test_redis_integ.sh`:
- **SC2145**: Argument mixes string and array (line 1219) - timeout + bash -c invocation issue
- **SC2034**: REQUESTS_PER_SECOND appears unused
- **SC2155**: Multiple declare+assign warnings (lines 191, 198, 586, 613, 624, 747, 1074)
- **SC2086**: Potential unquoted expansion issues
- Unsafe process-kill patterns using broad `pkill` and `pgrep`
- Inconsistent redis-cli usage (should use REDIS_CLI array consistently)

## Proposed Implementation

### 1. Add ShellCheck to CI
- Add ShellCheck step to existing GitHub Actions workflows
- Configure to check all shell scripts in the repository
- Set appropriate severity levels and exclusions

### 2. Add ShellCheck to pre-commit
- Add ShellCheck hook to `.pre-commit-config.yaml`
- Configure to run on shell script files (`.sh`, etc.)
- Ensure it runs before commits to catch issues early

### 3. Fix Existing Issues
- Address the current ShellCheck findings in system test scripts
- Establish coding standards for shell scripts

## Benefits
- Catch shell script bugs and security issues early
- Improve code quality and reliability
- Prevent common shell scripting pitfalls
- Maintain consistency across shell scripts

## References
- PR: https://github.com/Agent-Hellboy/gunicorn-prometheus-exporter/pull/82
- Comment: https://github.com/Agent-Hellboy/gunicorn-prometheus-exporter/pull/82#discussion_r2365401928

## Acceptance Criteria
- [ ] ShellCheck added to CI workflows
- [ ] ShellCheck added to pre-commit hooks
- [ ] Existing ShellCheck issues resolved
- [ ] Documentation updated with shell scripting guidelines

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.