ci: add lint, format-check, and security gates to CI pipeline#11
Merged
Sodawyx merged 2 commits intoMay 13, 2026
Merged
Conversation
Add three new CI enforcement layers that were previously missing: - ruff lint + format check job (was only in Makefile, never enforced in CI) - pip-audit dependency vulnerability scanning job - Expanded ruff rules: S (bandit/security), B (bugbear), UP (pyupgrade) Fix all resulting lint violations across src/ and tests/: - B904: add proper exception chains (raise from e) - E501: wrap long lines in help strings and docstrings - S110: annotate intentional try/except/pass with noqa + justification - S101: replace assert with proper guard in invoke_cmd - B007: prefix unused loop variable with underscore - UP022: use capture_output instead of stdout/stderr=PIPE Add matching Makefile targets (format-check, security) and pin pip-audit in dev dependencies for reproducible local runs. Change-Id: I94d2355be83f4c44b144f217d2a0d0d5b74f5e2f Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR adds CI enforcement for code quality and security checks (ruff lint/format + pip-audit) and updates the codebase to comply with the expanded Ruff rule set (security/bugbear/pyupgrade), primarily via exception chaining, safer typing, and formatting cleanups across src/ and tests/.
Changes:
- Add CI jobs for
ruff check,ruff format --check, andpip-audit, plus matchingMakefiletargets. - Expand Ruff lint rule selection to include
S,B, andUP, with test-specific per-file ignores. - Refactor Python code and tests to fix resulting lint violations (exception chaining, pyupgrade tweaks, long-line wrapping, typing modernizations).
Reviewed changes
Copilot reviewed 55 out of 55 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_tool_cmd.py | Reformats unit tests and removes unused imports to satisfy Ruff rules. |
| tests/unit/test_super_agent_yaml.py | Minor formatting simplifications in YAML parsing tests. |
| tests/unit/test_super_agent_state.py | Test formatting and context-manager style updates. |
| tests/unit/test_super_agent_repl.py | Adds exception chaining for async iterator StopIteration handling; formatting cleanups. |
| tests/unit/test_super_agent_render.py | Formatting updates and minor string literal normalization for render tests. |
| tests/unit/test_super_agent_helpers.py | Formatting updates and adds blank lines to satisfy style rules. |
| tests/unit/test_skill_cmd.py | Reformats skill command unit tests; removes unused imports and wraps long lines. |
| tests/unit/test_sandbox_helpers.py | Updates multi-context-manager syntax and formatting. |
| tests/unit/test_output.py | Removes unused imports and reformats long expressions in output formatter tests. |
| tests/unit/test_model_helpers.py | Updates module docstring and formatting for lint compliance. |
| tests/unit/test_main.py | Minor whitespace/style cleanup. |
| tests/unit/test_error.py | Removes unused imports. |
| tests/unit/test_config.py | Refactors with blocks and list formatting for lint compliance. |
| tests/integration/test_tool_cmd.py | Reformats CLI integration tests for tool commands. |
| tests/integration/test_super_agent_run_cmd.py | Adds exception chaining and reformats integration tests for sa run. |
| tests/integration/test_super_agent_invoke_cmd.py | Adds exception chaining and reformats integration tests for sa invoke. |
| tests/integration/test_super_agent_crud_cmd.py | Reformats integration tests for super-agent CRUD. |
| tests/integration/test_super_agent_conv_cmd.py | Reformats conversation subcommand integration tests and patching helpers. |
| tests/integration/test_super_agent_chat_cmd.py | Adds exception chaining and reformats chat integration tests. |
| tests/integration/test_super_agent_apply_cmd.py | Reformats apply/render integration tests. |
| tests/integration/test_skill_cmd.py | Reformats skill integration tests and patching blocks. |
| tests/integration/test_sandbox_cmd.py | Reformats sandbox integration tests; fixes unused loop var naming. |
| tests/integration/test_model_cmd.py | Reformats model integration tests and SDK patch helpers. |
| tests/integration/test_main.py | Minor whitespace/style cleanup. |
| tests/integration/test_install_script.py | Uses capture_output=True for subprocess calls (pyupgrade). |
| tests/integration/test_config_cmd.py | Refactors with blocks to modern syntax and formatting. |
| tests/integration/test_cli_basic.py | Removes unused imports and refactors with blocks; formatting updates. |
| src/agentrun_cli/commands/tool_cmd.py | Typing modernization (PEP 604), exception-message wrapping, and formatting for ruff compliance. |
| src/agentrun_cli/commands/super_agent/run_cmd.py | Reformats click options and adds raise ... from e for usage errors. |
| src/agentrun_cli/commands/super_agent/invoke_cmd.py | Typing modernization, removes assert, and adds exception chaining for JSON/usage errors. |
| src/agentrun_cli/commands/super_agent/crud_cmd.py | Reformats click options and multi-arg functions; minor string wrapping. |
| src/agentrun_cli/commands/super_agent/conv_cmd.py | Minor formatting cleanup in serialization output. |
| src/agentrun_cli/commands/super_agent/chat_cmd.py | Reformats click options and adds exception chaining on usage errors. |
| src/agentrun_cli/commands/super_agent/apply_cmd.py | Adds exception chaining for YAML schema errors; refactors formatting in render/apply. |
| src/agentrun_cli/commands/super_agent/_helpers.py | Typing modernization for ctx config helper. |
| src/agentrun_cli/commands/skill_cmd.py | Typing modernization, file open cleanup, noqa justification for broad exception, and formatting. |
| src/agentrun_cli/commands/sandbox/template_cmd.py | Typing import cleanup and extensive click option formatting/wrapping. |
| src/agentrun_cli/commands/sandbox/process_cmd.py | Wraps long help text to satisfy line-length rules. |
| src/agentrun_cli/commands/sandbox/lifecycle_cmd.py | Wraps long option help and refactors formatting; minor import spacing. |
| src/agentrun_cli/commands/sandbox/exec_cmd.py | Wraps long option help and usage error messages; formatting updates. |
| src/agentrun_cli/commands/sandbox/browser_cmd.py | Wraps long option help and refactors output formatting blocks. |
| src/agentrun_cli/commands/sandbox/_helpers.py | Typing modernization and file open cleanup. |
| src/agentrun_cli/commands/model_cmd.py | Typing modernization, file open cleanup, and click option wrapping. |
| src/agentrun_cli/commands/config_cmd.py | Wraps long output strings to satisfy line-length rules. |
| src/agentrun_cli/_utils/super_agent_yaml.py | Typing modernization (PEP 604 / builtin generics) and minor formatting. |
| src/agentrun_cli/_utils/super_agent_state.py | Typing modernization and file open cleanup. |
| src/agentrun_cli/_utils/super_agent_repl.py | Switches to collections.abc.Callable, typing modernization, and minor formatting. |
| src/agentrun_cli/_utils/super_agent_render.py | Typing modernization, adds noqa justifications for broad exception swallowing, and formatting. |
| src/agentrun_cli/_utils/output.py | Typing modernization and import cleanup; minor signature refactors. |
| src/agentrun_cli/_utils/inner_client.py | Typing modernization for client factory. |
| src/agentrun_cli/_utils/error.py | Switches to collections.abc.Callable and removes unused whitespace/import patterns. |
| src/agentrun_cli/_utils/config.py | Typing modernization, import cleanup, and formatting refactors. |
| pyproject.toml | Adds pip-audit dev dependency, expands Ruff rule selection, and adds per-file ignores for tests. |
| Makefile | Adds format-check and security targets for local enforcement parity with CI. |
| .github/workflows/ci.yml | Adds new CI jobs for Ruff lint/format checking and pip-audit vulnerability scanning. |
Comments suppressed due to low confidence (1)
pyproject.toml:57
- Same as above for the optional dev extras: pip-audit is added as ">=2.7.0" rather than being pinned. If you want reproducible audit behavior, use an exact pin (or bounded range) here as well so
pip install .[dev]always pulls the expected version.
[project.optional-dependencies]
dev = [
"pytest>=8.0.0", "pytest-cov>=6.0.0",
"pytest-asyncio>=1.2.0",
"pyinstaller>=6.0.0",
"ruff>=0.14.0",
"mypy>=1.11.0",
"types-PyYAML>=6.0",
"pip-audit>=2.7.0",
]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
37
to
46
| [dependency-groups] | ||
| dev = [ | ||
| "pytest>=8.0.0", "pytest-cov>=6.0.0", | ||
| "pytest-asyncio>=1.2.0", | ||
| "pyinstaller>=6.0.0", | ||
| "ruff>=0.14.0", | ||
| "mypy>=1.11.0", | ||
| "types-PyYAML>=6.0", | ||
| "pip-audit>=2.7.0", | ||
| ] |
…uard - Add _version.py to ruff exclude (setuptools-scm generated file) - Restore assert with noqa:S101 annotation for mypy type narrowing Change-Id: Ie640516e377c937dbb7145da6ca2c8e0424b8f84 Co-developed-by: Claude <noreply@anthropic.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Add three new CI enforcement layers that were previously missing:
Fix all resulting lint violations across src/ and tests/:
Add matching Makefile targets (format-check, security) and pin pip-audit in dev dependencies for reproducible local runs.
Change-Id: I94d2355be83f4c44b144f217d2a0d0d5b74f5e2f
Co-developed-by: Claude noreply@anthropic.com