mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-07-09 17:18:34 +00:00
ci: add shellcheck linting infrastructure
Added shellcheck to catch bash anti-patterns across 115 scripts: - Created .shellcheckrc configuration - Added GitHub Actions workflow (.github/workflows/lint.yml) - Documented shellcheck usage in README Currently found 3,598 warnings (expected for unlinted codebase). Using || true temporarily to not block PRs - warnings will be fixed incrementally in follow-up tasks. Common issues: SC2250 (missing braces), SC2162 (read without -r), SC2312 (command substitution masking), SC1091 (sourcing pattern). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
d053865c29
commit
99e13e89ad
3 changed files with 80 additions and 0 deletions
36
.github/workflows/lint.yml
vendored
Normal file
36
.github/workflows/lint.yml
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
name: Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, master ]
|
||||
pull_request:
|
||||
branches: [ main, master ]
|
||||
|
||||
jobs:
|
||||
shellcheck:
|
||||
name: ShellCheck
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install ShellCheck
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y shellcheck
|
||||
|
||||
- name: Run ShellCheck on all bash scripts
|
||||
run: |
|
||||
# Find all .sh files, excluding node_modules and other irrelevant directories
|
||||
# Note: Using || true temporarily - 3,598 existing warnings need gradual fixes
|
||||
find . -name "*.sh" \
|
||||
! -path "*/node_modules/*" \
|
||||
! -path "*/.git/*" \
|
||||
! -path "*/dist/*" \
|
||||
! -path "*/build/*" \
|
||||
-print0 | xargs -0 shellcheck || true
|
||||
|
||||
- name: ShellCheck version info
|
||||
if: always()
|
||||
run: shellcheck --version
|
||||
6
.shellcheckrc
Normal file
6
.shellcheckrc
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# shellcheck configuration for spawn
|
||||
# Enable all optional checks for maximum code quality
|
||||
enable=all
|
||||
|
||||
# Disable specific warnings that conflict with spawn's design patterns
|
||||
# (Add suppressions here after initial run if needed)
|
||||
38
README.md
38
README.md
|
|
@ -396,6 +396,44 @@ spawn/
|
|||
|
||||
---
|
||||
|
||||
## Development
|
||||
|
||||
### Running ShellCheck Locally
|
||||
|
||||
Spawn uses [ShellCheck](https://www.shellcheck.net/) to lint all bash scripts and catch common mistakes.
|
||||
|
||||
**Install ShellCheck:**
|
||||
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install shellcheck
|
||||
|
||||
# macOS
|
||||
brew install shellcheck
|
||||
|
||||
# Fedora
|
||||
sudo dnf install ShellCheck
|
||||
```
|
||||
|
||||
**Run on all scripts:**
|
||||
|
||||
```bash
|
||||
find . -name "*.sh" \
|
||||
! -path "*/node_modules/*" \
|
||||
! -path "*/.git/*" \
|
||||
-exec shellcheck {} +
|
||||
```
|
||||
|
||||
**Run on a single file:**
|
||||
|
||||
```bash
|
||||
shellcheck shared/common.sh
|
||||
```
|
||||
|
||||
The CI pipeline automatically runs shellcheck on all pull requests. See `.shellcheckrc` for configuration.
|
||||
|
||||
---
|
||||
|
||||
## Security
|
||||
|
||||
### API Token Storage
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue