3636
3737
3838class DryRunReporter :
39- """
40- Handles reporting of configuration and validation results in dry-run mode.
41- Provides clear, structured output for troubleshooting configuration issues.
42- """
43-
4439 @staticmethod
4540 def report_configuration (config : dict [str , Any ]) -> None :
46- """
47- Log the resolved configuration, focusing on key properties.
48- """
4941 logging .info ("=" * 80 )
5042 logging .info ("DRY RUN MODE - Configuration Report" )
5143 logging .info ("=" * 80 )
@@ -83,10 +75,6 @@ def report_configuration(config: dict[str, Any]) -> None:
8375
8476 @staticmethod
8577 def report_validation_results (validation_result : "ValidationResult" ) -> int :
86- """
87- Log validation results and return appropriate exit code.
88- Returns 0 if validation passed, non-zero if there were errors.
89- """
9078 logging .info ("=" * 80 )
9179 logging .info ("DRY RUN MODE - Validation Results" )
9280 logging .info ("=" * 80 )
@@ -110,15 +98,13 @@ def report_validation_results(validation_result: "ValidationResult") -> int:
11098
11199 @staticmethod
112100 def _log_section (title : str , values : dict [str , Any ]) -> None :
113- """Log a section of configuration values."""
114101 logging .info (f"\n { title } :" )
115102 for key , value in values .items ():
116103 formatted_key = DryRunReporter ._format_key (key )
117104 logging .info (f" { formatted_key } : { value } " )
118105
119106 @staticmethod
120107 def _format_key (key : str ) -> str :
121- """Format a property key for display."""
122108 if key .startswith ("sonar." ):
123109 key = key [6 :]
124110 key = key .replace ("." , " " ).replace ("_" , " " )
@@ -127,50 +113,31 @@ def _format_key(key: str) -> str:
127113
128114
129115class ValidationResult :
130- """Holds validation results for coverage reports and configuration."""
131-
132116 def __init__ (self ):
133117 self .errors : list [str ] = []
134118 self .warnings : list [str ] = []
135119 self .infos : list [str ] = []
136120
137121 def add_error (self , message : str ) -> None :
138- """Add a validation error."""
139122 self .errors .append (message )
140123
141124 def add_warning (self , message : str ) -> None :
142- """Add a validation warning."""
143125 self .warnings .append (message )
144126
145127 def add_info (self , message : str ) -> None :
146- """Add a validation info message."""
147128 self .infos .append (message )
148129
149130 def is_valid (self ) -> bool :
150- """Check if validation passed (no errors)."""
151131 return len (self .errors ) == 0
152132
153133
154134class CoverageReportValidator :
155- """
156- Validates coverage reports for format and accessibility.
157- Provides clear error messages for common issues.
158- """
159-
160135 @staticmethod
161136 def validate_coverage_reports (
162137 coverage_paths : Optional [str ],
163138 project_base_dir : str ,
164139 validation_result : ValidationResult ,
165140 ) -> None :
166- """
167- Validate coverage report paths.
168-
169- Args:
170- coverage_paths: Comma-separated coverage report paths
171- project_base_dir: Base directory for the project
172- validation_result: ValidationResult object to populate
173- """
174141 if not coverage_paths :
175142 validation_result .add_warning ("No coverage report paths specified" )
176143 return
@@ -183,7 +150,6 @@ def validate_coverage_reports(
183150
184151 @staticmethod
185152 def _validate_single_report (report_path : str , base_path : Path , validation_result : ValidationResult ) -> None :
186- """Validate a single coverage report file."""
187153 # Resolve relative path
188154 full_path = base_path / report_path if not Path (report_path ).is_absolute () else Path (report_path )
189155
0 commit comments