refactor(transcription_resizer): extract __init__ into smaller methods to fix R0915#1537
Merged
Conversation
…hods to fix R0915
…ethods to fix R0915
…thods to fix R0915
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1537 +/- ##
==========================================
+ Coverage 81.81% 82.87% +1.05%
==========================================
Files 108 108
Lines 11599 11620 +21
==========================================
+ Hits 9490 9630 +140
+ Misses 2109 1990 -119
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…izer-extract-init-R0915
raivisdejus
enabled auto-merge (squash)
July 1, 2026 10:39
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.
Why is this change necessary?
The
__init__method ofTranscriptionResizerWidgethad 114 statements, far exceeding Pylint's limit of 50 (R0915: too-many-statements). The method was responsible for all UI construction — labels, group boxes, layouts, checkboxes, spin boxes, buttons, and signal connections — in a single monolithic block. This violated the Single Responsibility Principle, harmed readability, and made maintenance harder.How was this tested?
All 5 existing tests in
tests/widgets/transcription_viewer/transcription_resizer_widget_test.pywere run and passed before committing:uv run python -m pytest tests/ -k "transcription_resizer" -x -q
Pylint was also re-run against the file and now gives a 10.00/10 rating with no
R0915warning.Notes for the reviewer
The extraction is purely mechanical — each UI section (Settings, Extend Endings, Resize Options, Merge Options) was moved into its own private method (
_setup_settings_section,_setup_extend_section,_setup_resize_section,_setup_merge_section). No logic, no attribute names, no signal/slot connections were changed. The refactoring is safe and straightforward.