Skip to content

fix: code quality improvements across all core scripts#6

Merged
trsoliu merged 1 commit into
mainfrom
feat/code-quality-fixes
May 2, 2026
Merged

fix: code quality improvements across all core scripts#6
trsoliu merged 1 commit into
mainfrom
feat/code-quality-fixes

Conversation

@trsoliu

@trsoliu trsoliu commented May 2, 2026

Copy link
Copy Markdown
Owner

Summary

Systematic code quality improvements across all 8 core Python scripts, addressing issues that Ruff and mypy would flag.

Changes

Import Sorting (all 8 files)

Sorted imports alphabetically following isort conventions (Ruff I rule):

  • Standard library imports first, then third-party, then local

Exception Handling

  • detect_changes.py: ExceptionOSError for file hash calculation
  • plugin_manager.py: Removed traceback.print_exc() from error handler

Type Annotations

  • detect_changes.py: Set[str] = NoneOptional[Set[str]] = None (3 functions)
  • analyze_project.py: Same fix for discover_modules

Dead Code Removal

  • plugin_manager.py: Removed 5 debug print() statements
  • analyze_project.py: Removed redundant import re inside function (already at module level)
  • generate_toc.py: Moved import json from inside function to module level

Style Fixes

  • analyze_project.py: Split single-line if statements onto separate lines (Ruff E701)

Verification

All 8 scripts verified to compile cleanly with python3 -m py_compile.

Statistics

  • 8 files changed, 44 insertions(+), 50 deletions(-)
  • Net reduction of 6 lines (removed dead code)

🤖 Generated with Claude Code

- Sort imports alphabetically (isort/Ruff I rule)
- Replace broad Exception catches with specific OSError
- Use Optional[T] instead of T = None for type hints
- Remove debug print statements from plugin_manager.py
- Remove internal import (re) already at module level in analyze_project.py
- Move json import to top level in generate_toc.py
- Fix single-line if statements in analyze_project.py (Ruff E701)
- Remove traceback.print_exc() from plugin_manager.py error handler

All 8 scripts verified to compile cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trsoliu trsoliu merged commit b78dd5d into main May 2, 2026
0 of 4 checks passed
@trsoliu trsoliu deleted the feat/code-quality-fixes branch May 2, 2026 12:05
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.

1 participant