@@ -75,7 +75,7 @@ func NewRunner(astCache *astcache.Cache, cfg *config.Config, log logutils.Log, g
7575 skipDirsProcessor , // must be after path prettifier
7676
7777 processors .NewAutogeneratedExclude (astCache ),
78- processors .NewIdentifierMarker (), // must be befor exclude
78+ processors .NewIdentifierMarker (), // must be before exclude because users see already marked output and configure excluding by it
7979 processors .NewExclude (excludeTotalPattern ),
8080 processors .NewExcludeRules (excludeRules , lineCache , log .Child ("exclude_rules" )),
8181 processors .NewNolint (astCache , log .Child ("nolint" ), dbManager ),
@@ -92,6 +92,8 @@ func NewRunner(astCache *astcache.Cache, cfg *config.Config, log logutils.Log, g
9292 }, nil
9393}
9494
95+ func someUnusedFunc () {}
96+
9597type lintRes struct {
9698 linter * linter.Config
9799 err error
@@ -217,13 +219,19 @@ func (r *Runner) runWorkers(ctx context.Context, lintCtx *linter.Context, linter
217219 return lintResultsCh
218220}
219221
222+ type processorStat struct {
223+ inCount int
224+ outCount int
225+ }
226+
220227func (r Runner ) processLintResults (inCh <- chan lintRes ) <- chan lintRes {
221228 outCh := make (chan lintRes , 64 )
222229
223230 go func () {
224231 sw := timeutils .NewStopwatch ("processing" , r .Log )
225232
226233 var issuesBefore , issuesAfter int
234+ statPerProcessor := map [string ]processorStat {}
227235 defer close (outCh )
228236
229237 for res := range inCh {
@@ -234,7 +242,7 @@ func (r Runner) processLintResults(inCh <-chan lintRes) <-chan lintRes {
234242
235243 if len (res .issues ) != 0 {
236244 issuesBefore += len (res .issues )
237- res .issues = r .processIssues (res .issues , sw )
245+ res .issues = r .processIssues (res .issues , sw , statPerProcessor )
238246 issuesAfter += len (res .issues )
239247 outCh <- res
240248 }
@@ -252,12 +260,23 @@ func (r Runner) processLintResults(inCh <-chan lintRes) <-chan lintRes {
252260 if issuesBefore != issuesAfter {
253261 r .Log .Infof ("Issues before processing: %d, after processing: %d" , issuesBefore , issuesAfter )
254262 }
263+ r .printPerProcessorStat (statPerProcessor )
255264 sw .PrintStages ()
256265 }()
257266
258267 return outCh
259268}
260269
270+ func (r Runner ) printPerProcessorStat (stat map [string ]processorStat ) {
271+ parts := make ([]string , 0 , len (stat ))
272+ for name , ps := range stat {
273+ if ps .inCount != 0 {
274+ parts = append (parts , fmt .Sprintf ("%s: %d/%d" , name , ps .outCount , ps .inCount ))
275+ }
276+ }
277+ r .Log .Infof ("Processors filtering stat (out/in): %s" , strings .Join (parts , ", " ))
278+ }
279+
261280func collectIssues (resCh <- chan lintRes ) <- chan result.Issue {
262281 retIssues := make (chan result.Issue , 1024 )
263282 go func () {
@@ -294,7 +313,7 @@ func (r Runner) Run(ctx context.Context, linters []*linter.Config, lintCtx *lint
294313 return collectIssues (processedLintResultsCh )
295314}
296315
297- func (r * Runner ) processIssues (issues []result.Issue , sw * timeutils.Stopwatch ) []result.Issue {
316+ func (r * Runner ) processIssues (issues []result.Issue , sw * timeutils.Stopwatch , statPerProcessor map [ string ] processorStat ) []result.Issue {
298317 for _ , p := range r .Processors {
299318 var newIssues []result.Issue
300319 var err error
@@ -306,6 +325,10 @@ func (r *Runner) processIssues(issues []result.Issue, sw *timeutils.Stopwatch) [
306325 if err != nil {
307326 r .Log .Warnf ("Can't process result by %s processor: %s" , p .Name (), err )
308327 } else {
328+ stat := statPerProcessor [p .Name ()]
329+ stat .inCount += len (issues )
330+ stat .outCount += len (newIssues )
331+ statPerProcessor [p .Name ()] = stat
309332 issues = newIssues
310333 }
311334
0 commit comments