fix(check): accept positional workspace arg - closes #78#80
Merged
Conversation
The check command's add_args() did not register a positional workspace
argument, but the CI quality-gate workflow calls:
python3 scripts/codelens.py check . --severity high --sarif
argparse rejected the '.' with 'unrecognized arguments: .', failing CI
for every PR.
Fix: add parser.add_argument("workspace", nargs="?", default=None)
to scripts/commands/check.py, matching the convention of all other
CodeLens commands.
3 regression tests added to tests/test_cli.py::TestCheckCommandArgs:
- test_check_accepts_positional_workspace
- test_check_workspace_optional
- test_check_full_cli_invocation_with_positional
Verified:
- 'codelens check /tmp --severity high --format json' now produces JSON
output instead of argparse error
- All 3 new tests pass
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
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.



Summary
Fix for P0 issue #78. The
checkcommand'sadd_args()did not register a positionalworkspaceargument, but the CI quality-gate workflow calls:argparse rejected the
.withunrecognized arguments: ., failing CI for every PR.Root cause
scripts/commands/check.pyadd_args()only defined optional flags (--severity,--max-findings,--health-min,--sarif,--commands). No positionalworkspaceargument, unlike all other CodeLens commands which useparser.add_argument("workspace", nargs="?", default=None).Fix
Added
parser.add_argument("workspace", nargs="?", default=None)tocheck.py, matching the convention of all other CodeLens commands.Verification
codelens check /tmp --severity high --format jsonnow produces JSON output instead of argparse errortests/test_cli.py::TestCheckCommandArgs:test_check_accepts_positional_workspace- argparse accepts positionaltest_check_workspace_optional- without positional, workspace=Nonetest_check_full_cli_invocation_with_positional- end-to-end subprocess testImpact
Unblocks CI
quality-gate (3.11)job for all future PRs. Combined with #76 (dashboard f-string fix) and #73 (store_scan_result fix), the quality-gate should now pass on clean PRs.Files
scripts/commands/check.py(1 line added)tests/test_cli.py(3 tests added, +70 LOC)Related