@@ -70,7 +70,7 @@ export class ContextLinter {
70
70
if ( await fileExists ( rootContextFile ) ) {
71
71
const content = await fs . promises . readFile ( rootContextFile , 'utf-8' ) ;
72
72
const result = await this . lintMarkdownFile ( content , rootContextFile ) ;
73
- this . printValidationResult ( result , rootContextFile ) ;
73
+ this . printValidationResult ( result , rootContextFile , this . logLevel === LogLevel . DEBUG ) ;
74
74
isValid = isValid && result . isValid ;
75
75
}
76
76
@@ -157,7 +157,7 @@ export class ContextLinter {
157
157
continue ;
158
158
}
159
159
160
- this . printValidationResult ( result , fullPath ) ;
160
+ this . printValidationResult ( result , fullPath , this . logLevel === LogLevel . DEBUG ) ;
161
161
isValid = isValid && result . isValid ;
162
162
}
163
163
@@ -317,31 +317,31 @@ export class ContextLinter {
317
317
* Print the validation result for a .context file
318
318
* @param result The validation result
319
319
* @param filePath The path of the file
320
+ * @param isDebug Whether the linter is in debug mode
320
321
*/
321
- private printValidationResult ( result : ValidationResult , filePath : string ) : void {
322
+ private printValidationResult ( result : ValidationResult , filePath : string , isDebug : boolean ) : void {
322
323
const relativePath = this . normalizePath ( path . relative ( process . cwd ( ) , filePath ) ) ;
323
324
this . log ( LogLevel . INFO , `Linting file: ${ relativePath } ` ) ;
324
325
326
+ if ( isDebug ) {
327
+ this . log ( LogLevel . INFO , '(Debug mode: ON)' ) ;
328
+ }
329
+
325
330
// Display main context coverage information at INFO level
326
331
this . log ( LogLevel . INFO , `Main context: ${ result . coveragePercentage . toFixed ( 2 ) } % (${ result . coveredFields } /${ result . totalFields } top level fields)` ) ;
327
332
328
- // Display section names at INFO level
329
- const sectionNames = Object . keys ( result . sections ) ;
330
- if ( sectionNames . length > 0 ) {
331
- this . log ( LogLevel . INFO , 'Sections:' ) ;
332
- sectionNames . forEach ( sectionName => {
333
- this . log ( LogLevel . INFO , ` - ${ sectionName } ` ) ;
334
- } ) ;
335
- }
336
-
337
- // Display detailed section coverage information at DEBUG level
338
- if ( this . logLevel === LogLevel . DEBUG ) {
339
- for ( const [ sectionName , sectionResult ] of Object . entries ( result . sections ) ) {
340
- this . log ( LogLevel . DEBUG , `|- ${ sectionName } : ${ sectionResult . coveragePercentage . toFixed ( 2 ) } % (${ sectionResult . coveredFields } /${ sectionResult . totalFields } fields)` ) ;
333
+ // Display detailed section coverage information
334
+ let incompleteSections = false ;
335
+ for ( const [ sectionName , sectionResult ] of Object . entries ( result . sections ) ) {
336
+ if ( isDebug || sectionResult . coveragePercentage < 100 ) {
337
+ this . log ( LogLevel . INFO , `|- ${ sectionName } : ${ sectionResult . coveragePercentage . toFixed ( 2 ) } % (${ sectionResult . coveredFields } /${ sectionResult . totalFields } fields)` ) ;
338
+ if ( sectionResult . coveragePercentage < 100 ) {
339
+ incompleteSections = true ;
340
+ }
341
341
}
342
342
}
343
343
344
- if ( ! result . isValid ) {
344
+ if ( ! result . isValid || incompleteSections ) {
345
345
this . log ( LogLevel . WARN , `⚠️ File has coverage warnings` ) ;
346
346
}
347
347
0 commit comments