@@ -67,6 +67,14 @@ func (c *Runner) Run(paths []string) error {
67
67
}
68
68
}
69
69
70
+ for pattern , count := range c .opts .excludedPathCounter {
71
+ if c .opts .warnUnused && count == 0 {
72
+ c .log .Warnf ("The pattern %q match no issues" , pattern )
73
+ } else {
74
+ c .log .Infof ("Skipped %d issues by pattern %q" , count , pattern )
75
+ }
76
+ }
77
+
70
78
return nil
71
79
}
72
80
@@ -181,6 +189,9 @@ type RunnerOptions struct {
181
189
diff bool
182
190
colors bool
183
191
stdin bool
192
+
193
+ warnUnused bool
194
+ excludedPathCounter map [* regexp.Regexp ]int
184
195
}
185
196
186
197
func NewRunnerOptions (cfg * config.Config , diff , diffColored , stdin bool ) (RunnerOptions , error ) {
@@ -190,11 +201,13 @@ func NewRunnerOptions(cfg *config.Config, diff, diffColored, stdin bool) (Runner
190
201
}
191
202
192
203
opts := RunnerOptions {
193
- basePath : basePath ,
194
- generated : cfg .Formatters .Exclusions .Generated ,
195
- diff : diff || diffColored ,
196
- colors : diffColored ,
197
- stdin : stdin ,
204
+ basePath : basePath ,
205
+ generated : cfg .Formatters .Exclusions .Generated ,
206
+ diff : diff || diffColored ,
207
+ colors : diffColored ,
208
+ stdin : stdin ,
209
+ excludedPathCounter : make (map [* regexp.Regexp ]int ),
210
+ warnUnused : cfg .Formatters .Exclusions .WarnUnused ,
198
211
}
199
212
200
213
for _ , pattern := range cfg .Formatters .Exclusions .Paths {
@@ -204,6 +217,7 @@ func NewRunnerOptions(cfg *config.Config, diff, diffColored, stdin bool) (Runner
204
217
}
205
218
206
219
opts .patterns = append (opts .patterns , exp )
220
+ opts .excludedPathCounter [exp ] = 0
207
221
}
208
222
209
223
return opts , nil
@@ -221,6 +235,7 @@ func (o RunnerOptions) MatchAnyPattern(path string) (bool, error) {
221
235
222
236
for _ , pattern := range o .patterns {
223
237
if pattern .MatchString (rel ) {
238
+ o .excludedPathCounter [pattern ]++
224
239
return true , nil
225
240
}
226
241
}
0 commit comments