feat: PR comment bot#15
Open
chaksaray wants to merge 18 commits into
Open
Conversation
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
…s call Removes the direct `from scanner.scanner import scan, SEVERITY_SCORES` import (CLAUDE.md rule 5 violation) and replaces it with a subprocess call to `bawbel scan --format json` using list form — the same contract used by action.yml and the VS Code extension. Adds tests/hooks/test_pre_commit.py with 14 tests covering: clean files, threshold comparisons, GracefulDegradation (bawbel not installed → exit 0), JSON parse errors, subprocess list-form enforcement, and a static AST check that scanner.* is never imported. Closes #17
…e/suppressions.ts filterInlineIgnored is suppression logic — it belongs alongside isSuppressed, addSuppression, and removeSuppression in core/suppressions.ts, not in the rendering layer. Also fixes a latent bug in the original: the regex excluded hyphens from capture, silently failing to match rule IDs like bawbel-shell-pipe and AVE IDs like AVE-2026-00001. While here: moves rawCache from module-level state to a private instance property on DiagnosticsManager (closes #20), and replaces the inline require("fs") with the top-level import already present in suppressions.ts. Sets up vitest + vscode mock so TypeScript unit tests run without a VS Code host. Adds 11 tests covering all bawbel-ignore comment formats and edge cases. Closes #19
Replaces four separate python3 -c subprocess calls (each opening bawbel.yml independently) with a single call to scripts/load_config.py. The script reads bawbel.yml once, applies ConfigPriority (ActionInput > bawbel.yml > default), and prints resolved key=value pairs that the action step pipes directly to \$GITHUB_OUTPUT. Adds 18 tests in tests/action/test_load_config.py covering: missing file, malformed YAML, all four fields, boolean normalisation, ConfigPriority override logic, and CLI output key format. Closes #21
…line Python Adds What/Why/How comments to all six logical sections of the inline Python block in the "Post PR comment" step, plus a top-level Sec: block covering the four security questions (INPUT/OUTPUT/TRUST/ERROR) for the whole script. No functional changes. Removes one unused variable (fp) noticed while writing the detail-parsing comment. Closes #22
Pulls the severity→DiagnosticSeverity mapping out of buildActiveDiag into a standalone exported function with a What/Why/How comment. The function takes two numbers and returns an enum value — no VS Code state, no side effects, fully testable without a mock extension host. Also hardens the unknown-severity case: previously SEVERITY_INDEX lookup could return undefined and coerce to NaN (always < threshold), now explicitly defaults to 0 via the ?? operator so the behaviour is clear. Adds 10 tests in src/test/features/diagnostics.test.ts covering all threshold boundary combinations and the unknown-severity fallback. Closes #23
pipx installs binaries to ~/.local/pipx/venvs/<package>/bin/<binary>, not ~/.local/pipx/<package>/bin/<binary>. The missing venvs/ segment meant the path never resolved, silently skipping pipx-installed bawbel and requiring users to set bawbel.bawbelPath manually. Also exports CANDIDATE_PATHS so the list can be verified in tests. Adds 4 tests confirming the correct path is present, the wrong path is absent, and the two other common install locations are covered. Closes #24
…ing() Adds 7 missing fields to BawbelFinding (owasp_mcp, aivss_score, aivss, piranha_url, evidence_stage, confidence, derived) based on actual CLI output. Makes line: number | null since file-level findings carry no line number. Makes cvss_ai optional (not present in v1.2+ CLI output). Adds AivssBreakdown interface for the nested aivss object. Adds exported normaliseFinding() to parser.ts — the single seam where CLI field names map to BawbelFinding; normaliseFileResult now calls it instead of casting findings directly. 11 new tests in parser.test.ts. Closes #25
… of renderDiagnostics() renderDiagnostics() was called N times per scan batch, reading .bawbel-suppress.json and VS Code config on every iteration. Extract resolveFailSevIdx() private helper. applyResults() and reRenderAll() now load suppressions and config once and pass them into renderDiagnostics(suppressions, failSevIdx). reRender() (single file) also loads once per call. 2 new tests verify the invariant. Closes #26
…s and add Sec: block
filePath.split("/").pop() fails on Windows where the path separator
is backslash. Replace both occurrences with path.basename(filePath).
Add What/Why/How + Sec: block to show() per CLAUDE.md rule — it calls
runCommand() which spawns a subprocess.
Remove unused BawbelFileResult import.
Closes #27
…ppressions.ts resolveGitUser() spawns git subprocess — CLAUDE.md requires a Sec: block for any function that runs a subprocess. Replace JSDoc comment with structured What/Why/How + Sec: format per project rules. Closes #28
…valid SARIF When bawbel scan crashes, times out, or is not installed, the redirect `> bawbel-results.sarif` creates an empty or plain-text file. CodeQL's upload-sarif then fails with "Unexpected end of JSON input". After writing the SARIF, validate it with json.load(). If validation fails, echo bawbel's stderr to the CI log and overwrite the file with a minimal valid empty SARIF so upload-sarif always receives parseable input. 5 new tests in tests/action/test_sarif_fallback.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
integrate bawbel PR comment bot into PR