Skip to content

feat(analyzers): add shellcheck analyzer for shell scripts#36

Merged
hummbl-dev merged 1 commit into
mainfrom
feat/claude/shell-analyzer
Apr 18, 2026
Merged

feat(analyzers): add shellcheck analyzer for shell scripts#36
hummbl-dev merged 1 commit into
mainfrom
feat/claude/shell-analyzer

Conversation

@hummbl-dev
Copy link
Copy Markdown
Owner

Summary

  • Adds ShellAnalyzer that runs shellcheck --format=json on .sh/.bash files and maps findings to Arbiter's Finding dataclass
  • Maps shellcheck severity levels: error->HIGH, warning->MEDIUM, info/style->LOW
  • Wired into _get_analyzers() in __main__.py alongside existing analyzers

Test plan

  • 9 new tests in tests/test_shell_analyzer.py covering:
    • Name property returns "shellcheck"
    • is_available() checks shutil.which("shellcheck")
    • JSON output parsing with 4 sample findings
    • Severity mapping for all 4 shellcheck levels
    • Empty repo (no shell files) returns empty list
    • Exclude paths are respected
    • Empty shellcheck output handled gracefully
    • Invalid JSON handled gracefully
    • .bash extension files are discovered
  • Full test suite passes (366 tests)

🤖 Generated with Claude Code

Adds ShellAnalyzer that runs shellcheck --format=json on .sh/.bash files,
maps severity levels (error->HIGH, warning->MEDIUM, info/style->LOW), and
returns Finding objects. Wired into _get_analyzers() in __main__.py.

9 tests covering parsing, severity mapping, exclude paths, edge cases.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@hummbl-dev hummbl-dev merged commit d2874b8 into main Apr 18, 2026
3 checks passed
@hummbl-dev hummbl-dev deleted the feat/claude/shell-analyzer branch April 18, 2026 18:04
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 800b2e7a42

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/arbiter/__main__.py
SemgrepAnalyzer(), # opt-in: requires ARBITER_ENABLE_SEMGREP=1
DeadCodeAnalyzer(),
DuplicationAnalyzer(),
ShellAnalyzer(),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip ShellAnalyzer in Python-only diff scoring

Registering ShellAnalyzer() in _get_analyzers() makes commit/diff scoring paths invoke shellcheck even when scoring only changed *.py files. In diff_analyzer._run_analyzers_on_files, each analyzer is run once per changed Python file and findings are then filtered to Python targets, so shellcheck findings cannot contribute to the score but still incur repeated scans/subprocess calls; on repos with shellcheck installed this creates a significant avoidable runtime regression for score_commit/score_diff and historical commit scoring.

Useful? React with 👍 / 👎.

shell_files: list[Path] = []
for pattern in ("**/*.sh", "**/*.bash"):
for f in repo_path.glob(pattern):
if not any(part in excludes for part in f.relative_to(repo_path).parts):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize exclude paths before part-wise matching

The exclude check compares each path component against raw exclude_paths, which breaks common exclude values like tests/ or nested paths like scripts/ci (Path.parts yields tests, scripts, ci). That means shell files inside user-excluded directories are still sent to shellcheck, producing findings from paths users explicitly asked to skip.

Useful? React with 👍 / 👎.

hummbl-dev pushed a commit that referenced this pull request Apr 18, 2026
Phase 2 polyglot expansion:
- ESLint analyzer for JavaScript/TypeScript (eslint JSON output)
- Go analyzer via golangci-lint (JSON output, go.mod detection)
- Rust analyzer via cargo clippy (NDJSON output, Cargo.toml detection)
- Language detection module with 25+ languages, `languages` CLI subcommand
- All analyzers follow the same Analyzer interface pattern

Combined with shellcheck (#36), Arbiter now scores Python, Shell,
JavaScript, TypeScript, Go, and Rust.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
hummbl-dev added a commit that referenced this pull request Apr 18, 2026
Phase 2 polyglot expansion:
- ESLint analyzer for JavaScript/TypeScript (eslint JSON output)
- Go analyzer via golangci-lint (JSON output, go.mod detection)
- Rust analyzer via cargo clippy (NDJSON output, Cargo.toml detection)
- Language detection module with 25+ languages, `languages` CLI subcommand
- All analyzers follow the same Analyzer interface pattern

Combined with shellcheck (#36), Arbiter now scores Python, Shell,
JavaScript, TypeScript, Go, and Rust.

Co-authored-by: Claude (agent) <claude@agents.hummbl.io>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
hummbl-dev pushed a commit that referenced this pull request Apr 18, 2026
Phase 1 (Contribution Engine): 6/6 done — PRs #29-34
Phase 2 (Polyglot Expansion): 6/6 done — PRs #36, #40, #41
Contribution tracker seeded with 6 OSS PRs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant