-
Notifications
You must be signed in to change notification settings - Fork 10
hatch fmt --linter #138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
hatch fmt --linter #138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR primarily applies hatch fmt --linter fixes and import reordering, and adjusts logging to use logging.exception in exception handlers. The changes are largely stylistic and linter-driven, with a few small behavioral tweaks to error handling and string construction.
Changes:
- Reordered and cleaned up imports across tests, core modules, and MCP server/backends (including removal of unused imports and standardization of open calls).
- Replaced several
logging.errorcalls insideexceptblocks withlogging.exception, and simplified control flow (removing redundantelsebranches afterreturn). - Updated type hints, generic usage, and some internal helper logic in MCP-related modules and the embedded
jsonrpycfork to satisfy linters.
Reviewed changes
Copilot reviewed 24 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_yaml_parser.py | Added a blank line between pytest and local imports to satisfy import grouping style. |
| tests/test_cli_parser.py | Same import-grouping blank line adjustment as above. |
| tests/test_api_endpoint_config.py | Reordered imports (standard library, third-party, local) and split a long import from capi into a multi-name import on separate lines. |
| src/seclab_taskflow_agent/shell_utils.py | Reordered imports so logging precedes other standard-library imports. |
| src/seclab_taskflow_agent/render_utils.py | Reordered imports and simplified flush_async_output by removing an unnecessary else branch after a return. |
| src/seclab_taskflow_agent/path_utils.py | Reordered imports (os, Path, then platformdirs) and added a spacing line, no functional changes. |
| src/seclab_taskflow_agent/mcp_utils.py | Reorganized imports, updated type hints to PEP 604 (X | None), simplified conditional branches (e.g., elif→if after return), and refactored mcp_system_prompt to use an f-string for the base prompt and another f-string for the task section. |
| src/seclab_taskflow_agent/mcp_servers/memcache/memcache_backend/sqlite.py | Reordered imports, adjusted import from .sql_models, and simplified get_state/delete_state control flow by removing redundant elif/else branches after return while preserving behavior. |
| src/seclab_taskflow_agent/mcp_servers/memcache/memcache_backend/sql_models.py | Trimmed unused SQLAlchemy imports, keeping only Text, DeclarativeBase, Mapped, and mapped_column required by KeyValue. |
| src/seclab_taskflow_agent/mcp_servers/memcache/memcache_backend/dictionary_file.py | Reordered imports, allowed open to use default read mode, and simplified delete_state / _add_state logic by removing redundant else branches. |
| src/seclab_taskflow_agent/mcp_servers/memcache/memcache.py | Reordered imports, moving json/logging/os/Any and FastMCP above internal imports from path_utils and backend modules. |
| src/seclab_taskflow_agent/mcp_servers/logbook/logbook.py | Reordered imports and removed explicit "r" in an open call, relying on default read mode. |
| src/seclab_taskflow_agent/mcp_servers/echo/echo.py | Added a blank line between third-party and local imports. |
| src/seclab_taskflow_agent/mcp_servers/codeql/mcp_server.py | Reworked imports (dropped unused ones, split responsibilities), updated FastMCP usage, and simplified URI normalization in get_file_contents using str.removeprefix. |
| src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/meta.py | Removed legacy encoding comment (# coding: utf-8), no runtime impact in Python 3. |
| src/seclab_taskflow_agent/mcp_servers/codeql/jsonrpyc/init.py | Modernized typing imports and aliases, changed classes to use Python 3 style (class Spec: / class RPC:), adjusted type hints, and swapped io.open for built-in open on stdin/stdout; note: now imports TypeAlias from typing, which is incompatible with Python 3.9 and below. |
| src/seclab_taskflow_agent/mcp_servers/codeql/client.py | Reordered imports, normalized some open calls, refactored context-manager __enter__ path to avoid a nested else, and slightly tweaked formatting calls (f\"{resolved_path!s}\"). |
| src/seclab_taskflow_agent/env_utils.py | Reordered imports (os before re), logic unchanged. |
| src/seclab_taskflow_agent/capi.py | Reordered imports and updated exception handlers in list_capi_models to use logging.exception instead of interpolating the exception into logging.error. |
| src/seclab_taskflow_agent/available_tools.py | Reordered imports and removed unused logging; kept core YAML loading and validation logic unchanged. |
| src/seclab_taskflow_agent/agent.py | Reworked imports to use agents’ re-exported symbols, reorganized dotenv/openai imports, and aligned with the new capi import order; note: RunHooks is now imported twice (from both agents and agents.run). |
| src/seclab_taskflow_agent/main.py | Substantial import reordering and cleanup (e.g., dropped unused pprint), switched many logging.error calls inside except blocks to logging.exception, simplified some conditionals and loops, and reordered internal imports to match new module structure. |
| release_tools/publish_docker.py | Removed unused os and shutil imports; core Docker build/push logic unchanged. |
| release_tools/copy_files.py | Reordered imports, adjusted open to use the default read mode in read_file_list, and moved sys import after subprocess for style consistency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 26 out of 26 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hatch fmt --linter.logging.errorgot replaced bylogging.exceptionin the first commit.