@@ -42,6 +42,10 @@ type ClassifiedEntry = {
4242 readonly classification ?: CoverageClassification ;
4343} ;
4444
45+ type UnmatchedMonitoredPattern = {
46+ readonly pattern : string ;
47+ } ;
48+
4549const args = new Set ( process . argv . slice ( 2 ) ) ;
4650const json = args . has ( "--json" ) ;
4751const check = args . has ( "--check" ) ;
@@ -67,6 +71,17 @@ const monitoredEntries = flattenConfigDocBaselineEntries(baseline)
6771 . filter ( ( entry ) => ! entry . hasChildren )
6872 . filter ( ( entry ) => matchesAny ( config . monitored , entry . path ) )
6973 . toSorted ( ( left , right ) => left . path . localeCompare ( right . path ) ) ;
74+ const leafEntries = flattenConfigDocBaselineEntries ( baseline ) . filter ( ( entry ) => ! entry . hasChildren ) ;
75+ const unmatchedMonitored = config . monitored
76+ . filter (
77+ ( pattern ) =>
78+ ! leafEntries . some ( ( entry ) => pathMatchesPattern ( pattern , entry . path ) ) &&
79+ ! config . classifications . some (
80+ ( item ) => item . allowNoSchemaPath === true && pathMatchesPattern ( item . pattern , pattern ) ,
81+ ) ,
82+ )
83+ . map ( ( pattern ) => ( { pattern } ) )
84+ . toSorted ( ( left , right ) => left . pattern . localeCompare ( right . pattern ) ) ;
7085
7186const classified : ClassifiedEntry [ ] = monitoredEntries . map ( ( entry ) => ( {
7287 path : entry . path ,
@@ -87,10 +102,11 @@ if (json) {
87102 console . log (
88103 JSON . stringify (
89104 {
90- ok : unclassified . length === 0 && stale . length === 0 ,
105+ ok : unclassified . length === 0 && stale . length === 0 && unmatchedMonitored . length === 0 ,
91106 monitoredPaths : monitoredEntries . length ,
92107 counts : summaryCounts ,
93108 unclassified,
109+ unmatchedMonitored,
94110 stale,
95111 } ,
96112 null ,
@@ -102,19 +118,21 @@ if (json) {
102118 monitoredPaths : monitoredEntries . length ,
103119 counts : summaryCounts ,
104120 unclassified,
121+ unmatchedMonitored,
105122 stale,
106123 classified,
107124 } ) ;
108125}
109126
110- if ( check && ( unclassified . length > 0 || stale . length > 0 ) ) {
127+ if ( check && ( unclassified . length > 0 || stale . length > 0 || unmatchedMonitored . length > 0 ) ) {
111128 process . exit ( 1 ) ;
112129}
113130
114131function printTextReport ( input : {
115132 readonly monitoredPaths : number ;
116133 readonly counts : Record < string , number > ;
117134 readonly unclassified : readonly ClassifiedEntry [ ] ;
135+ readonly unmatchedMonitored : readonly UnmatchedMonitoredPattern [ ] ;
118136 readonly stale : readonly CoverageClassification [ ] ;
119137 readonly classified : readonly ClassifiedEntry [ ] ;
120138} ) : void {
@@ -137,6 +155,15 @@ function printTextReport(input: {
137155 console. log ( "\nNo unclassified monitored config paths." ) ;
138156 }
139157
158+ if ( input . unmatchedMonitored . length > 0 ) {
159+ console . log ( "\nMonitored patterns with no matching config paths:" ) ;
160+ for ( const entry of input . unmatchedMonitored ) {
161+ console . log ( ` - ${ entry . pattern } ` ) ;
162+ }
163+ } else {
164+ console. log ( "\nNo monitored patterns without matching config paths." ) ;
165+ }
166+
140167 if ( input . stale . length > 0 ) {
141168 console . log ( "\nStale coverage classifications:" ) ;
142169 for ( const entry of input . stale ) {
0 commit comments