Repository navigation
review: -f sarif output for GitHub code scanning; release 0.3.0 - #34
Merged
Merged
Conversation
`crewforge review PATH -f sarif` writes one SARIF result per finding so CI can upload review findings to GitHub code scanning. Severity maps to level (critical/error -> error, warning -> warning, info -> note); the rule is the finding's CWE, else the reviewer. In a directory review the line a reviewer reports refers to the joined `# File:` text, so `Sources` now records where each file sits and maps the line back; unmappable lines keep the reviewed path without a region. Failed reviewers appear in `invocations`; exit codes are unchanged. Release 0.3.0. Closes #3 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
-f sarif output for GitHub code scanning; release 0.3.0
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.
Closes #3.
Gap
crewforge reviewprintstext,jsonandmarkdown. GitHub code scanning reads Static Analysis Results InterchangeFormat (
sarif) 2.1.0, and comparable review and lint tools already offer that output for CI:scanaislop/aislop (
aislop scan --sarif),agent-sh/agentsys (
agnix --format sarif),duriantaco/skylos (
--format sarif) andhyhmrright/brooks-lint. crewforge had no such option.
What this adds
-f sarifoncrewforge review(a newclick.Choicevalue; existing formats and exit codes 0/1/2 unchanged).report_sarif(result, sources, target)inrecipes/review/report.py, written from the published specification withthe standard library only. One
run,tool.driver.name = "crewforge", oneresultper finding:critical/erroras levelerror,warningaswarning,infoasnote;ruleIdis the finding's CWE, elsethe reviewer's name; the message is title, description and the suggested fix.
Sourcesnow records which lines of the joined# File:text belong to whichfile, and
Sources.locate(line)maps a reported line back to(file, line). A line that is missing, not an integer,on a header or outside the code keeps the reviewed path with no
region, so code scanning never points at a wrong line.--allow-partial) are listed ininvocations[0].toolExecutionNotificationsandexecutionSuccessfulis false. Without the flag a failed reviewer still exits 1 and no report is written.upload-sarifworkflow example, and the Bahasa Melayu summary.CHANGELOG
[0.3.0]credits aislop and agentsys; version 0.3.0 inpyproject.toml,__init__,CITATION.cffand the crewforge entry in
uv.lock. No new dependency.How it was tested
tests/recipes/review/test_sarif.py(21 tests, fake endpoint, no API key): the CLI output hasversion == "2.1.0",$schema,runs[0].tool.driver.name == "crewforge"and one result per finding with the mapped level; failedreviewers still exit 1;
--allow-partialmarks the run unsuccessful and names the agent; each severity maps to itslevel; non-integer and out-of-range lines get no region; relative paths stay relative; and for a directory, every
line of the joined text maps to the identical line in its own file.
boolcheck,
executionSuccessful) and the new tests went red each time.locally with
jsonschema, not added as a dependency).uv sync --locked --extra dev --extra docs,ruff check,ruff format --check,mypy,pytest -q -W error::DeprecationWarning: all passed, 770 tests.🤖 Generated with Claude Code