refactor(speaker-identification-widget): extract __init__ into smaller methods to fix R0915#1536
Merged
raivisdejus merged 6 commits intoJul 1, 2026
Conversation
…hods to fix R0915
…ethods to fix R0915
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1536 +/- ##
=======================================
Coverage 81.78% 81.79%
=======================================
Files 108 108
Lines 11581 11599 +18
=======================================
+ Hits 9472 9487 +15
- Misses 2109 2112 +3
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:
|
raivisdejus
enabled auto-merge (squash)
July 1, 2026 06:54
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 ofSpeakerIdentificationWidgethad 88 statements, far exceeding Pylint's limit of 50 (too-many-statements/ R0915). This made the method hard to read, test, and maintain — it was responsible for:Having all this logic in a single method violates the Single Responsibility Principle and hurts maintainability.
How was this tested?
All existing tests were run and passed successfully:
The refactoring is purely structural — no behavior was changed.
Notes for the reviewer
The original
__init__was broken down into four private methods, each with a clear responsibility:_create_step_1_group(layout)— builds the "Identify speakers" section (label, buttons, progress bar)_create_step_2_group(layout)— builds the "Name speakers" section (label, speaker input, preview button)_create_save_section(layout)— builds the merge checkbox and save button_setup_audio_player()— initializes theQMediaPlayerandQAudioOutputThe extracted methods follow the existing codebase patterns and are placed right after
__init__, before the event handlers. No logic was altered, only relocated.