refactor(cli) Remove redundant traceback + extract MockImporter#531
Open
refactor(cli) Remove redundant traceback + extract MockImporter#531
Conversation
why: log.exception already includes the full traceback in logging output. what: - Remove 11 redundant traceback.print_exc() blocks from add.py, discover.py, fmt.py - Replace traceback.print_exc in sync.py with log.debug(exc_info=True) - Remove unused import traceback in add.py, discover.py, fmt.py
why: MockImporter and CapturingMockImporter are test helpers that can be shared across CLI test files. what: - Move MockImporter and CapturingMockImporter to tests/cli/conftest.py - Update test_import_repos.py to import from conftest
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #531 +/- ##
==========================================
+ Coverage 83.51% 84.03% +0.52%
==========================================
Files 29 29
Lines 3645 3620 -25
Branches 726 715 -11
==========================================
- Hits 3044 3042 -2
+ Misses 386 366 -20
+ Partials 215 212 -3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Member
Author
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
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
Commit 1: Remove redundant
traceback.print_exc()afterlog.exception()log.exception()already includes the full traceback in logging outputtraceback.print_exc()blocks acrossadd.py(5),discover.py(3),fmt.py(2)sync.pyhad a different case (traceback.print_exc()afterlog.debug()): replaced with idiomaticlog.debug(..., exc_info=True)import tracebackfrom 3 filesCommit 2: Extract shared
MockImportertotests/cli/conftest.pyMockImporterandCapturingMockImporterfromtest_import_repos.pytotests/cli/conftest.pytest_import_repos.pyto import from conftestTest plan
uv run ruff check .— all checks passeduv run ruff format .— no changes neededuv run mypy— no issues founduv run py.test -vvv— 1172 passed