Skip to content

fix(check): accept positional workspace arg - closes #78#80

Merged
Wolfvin merged 1 commit into
mainfrom
fix/78-check-positional-workspace
Jun 28, 2026
Merged

fix(check): accept positional workspace arg - closes #78#80
Wolfvin merged 1 commit into
mainfrom
fix/78-check-positional-workspace

Conversation

@Wolfvin

@Wolfvin Wolfvin commented Jun 28, 2026

Copy link
Copy Markdown
Owner

Summary

Fix for P0 issue #78. 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.

Root cause

scripts/commands/check.py add_args() only defined optional flags (--severity, --max-findings, --health-min, --sarif, --commands). No positional workspace argument, unlike all other CodeLens commands which use parser.add_argument("workspace", nargs="?", default=None).

Fix

Added parser.add_argument("workspace", nargs="?", default=None) to check.py, matching the convention of all other CodeLens commands.

Verification

  • codelens check /tmp --severity high --format json now produces JSON output instead of argparse error
  • 3 regression tests added to tests/test_cli.py::TestCheckCommandArgs:
    • test_check_accepts_positional_workspace - argparse accepts positional
    • test_check_workspace_optional - without positional, workspace=None
    • test_check_full_cli_invocation_with_positional - end-to-end subprocess test
  • All 3 new tests pass

Impact

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

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
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Wolfvin Wolfvin merged commit 008b9a7 into main Jun 28, 2026
0 of 6 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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.

[BUG-P0] check command rejects positional workspace arg - CI quality-gate broken for all PRs

1 participant