@@ -94,6 +94,8 @@ impl fmt::Display for IssueReport {
9494 }
9595}
9696
97+ /// The main validation function. Checks all possible issues in a single file, loaded from a file name.
98+ /// Prints the issues to the standard output.
9799pub fn validate ( file_name : & str ) {
98100 debug ! ( "Validating file `{}`" , file_name) ;
99101
@@ -129,14 +131,22 @@ pub fn validate(file_name: &str) {
129131
130132/// Print a sorted, human-readable report about the issues found in the file
131133fn report_issues ( mut issues : Vec < IssueReport > , file_path : & str ) {
132- if !issues. is_empty ( ) {
133- // Sort the reported issues by their line number
134- issues. sort_by_key ( |report| report. line_number ) ;
134+ if issues. is_empty ( ) {
135+ // If there are no issues in the file, report that as info to avoid confusion over a blank output.
136+ issues. push ( IssueReport {
137+ line_number : None ,
138+ description : "No issues found in this file." ,
139+ severity : IssueSeverity :: Information ,
140+ } ) ;
141+ }
135142
136- println ! ( "💾 File: {}" , file_path) ;
137- for issue in issues {
138- println ! ( " {}" , issue) ;
139- }
143+ // Sort the reported issues by their line number
144+ issues. sort_by_key ( |report| report. line_number ) ;
145+
146+ // Print the sorted reports for the file to the standard output
147+ println ! ( "💾 File: {}" , file_path) ;
148+ for issue in issues {
149+ println ! ( " {}" , issue) ;
140150 }
141151}
142152
0 commit comments