-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Extract Verbosity Filtering Logic
Issue: This issue
Parent Epic: #102 - User Output Architecture Improvements
Related: Refactoring Plan - Proposal #0
Overview
Extract verbosity checking logic from UserOutput into a dedicated VerbosityFilter struct. This eliminates code duplication across all output methods and makes verbosity rules testable independently.
See detailed specification: docs/issues/extract-verbosity-filtering-logic.md (will be renamed after issue creation)
Implementation Plan
Phase 1: Create VerbosityFilter (30 minutes)
- Create
VerbosityFilterstruct withlevelfield - Implement
new()constructor - Implement
should_show()base method - Add convenience methods:
should_show_progress(),should_show_errors(), etc.
Phase 2: Add Unit Tests (45 minutes)
- Test
should_show_progress()at different verbosity levels - Test
should_show_errors()always returns true - Test general
should_show()method - Verify edge cases and boundary conditions
Phase 3: Integrate with UserOutput (1 hour)
- Replace
verbosity: VerbosityLevelfield withverbosity_filter: VerbosityFilter - Update
UserOutput::new()constructor - Update
UserOutput::with_writers()constructor - Update all output methods to use
verbosity_filter.should_show_X()
Phase 4: Verify & Clean Up (30 minutes)
- Run all existing tests and verify they pass
- Run linters:
cargo run --bin linter all - Review code for any remaining inline verbosity checks
- Update module documentation if needed
Acceptance Criteria
Quality Checks:
- Pre-commit checks pass:
./scripts/pre-commit.sh
Task-Specific Criteria:
-
VerbosityFilterstruct created with all required methods - All inline verbosity checks replaced with filter method calls
- Unit tests added for
VerbosityFilterbehavior - All existing tests still pass without modification
- No breaking changes to public
UserOutputAPI - Module documentation updated if needed
Estimated Time
Total: ~3 hours (conservative estimate with testing and verification)
Copilot