mirror of
https://github.com/numtide/treefmt.git
synced 2024-10-05 21:17:37 +03:00
feat: log out when a path is not matched to any formatter
Signed-off-by: Brian McGee <brian@bmcgee.ie>
This commit is contained in:
parent
3c264c623e
commit
c002eca8b7
@ -57,12 +57,12 @@ func (f *Format) Run() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a prefixed logger
|
// create a prefixed logger
|
||||||
l := log.WithPrefix("format")
|
log.SetPrefix("format")
|
||||||
|
|
||||||
// ensure cache is closed on return
|
// ensure cache is closed on return
|
||||||
defer func() {
|
defer func() {
|
||||||
if err := cache.Close(); err != nil {
|
if err := cache.Close(); err != nil {
|
||||||
l.Errorf("failed to close cache: %v", err)
|
log.Errorf("failed to close cache: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ func (f *Format) Run() (err error) {
|
|||||||
formatterCfg := cfg.Formatters[name]
|
formatterCfg := cfg.Formatters[name]
|
||||||
formatter, err := format.NewFormatter(name, Cli.TreeRoot, formatterCfg, globalExcludes)
|
formatter, err := format.NewFormatter(name, Cli.TreeRoot, formatterCfg, globalExcludes)
|
||||||
if errors.Is(err, format.ErrCommandNotFound) && Cli.AllowMissingFormatter {
|
if errors.Is(err, format.ErrCommandNotFound) && Cli.AllowMissingFormatter {
|
||||||
l.Debugf("formatter not found: %v", name)
|
log.Debugf("formatter not found: %v", name)
|
||||||
continue
|
continue
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
return fmt.Errorf("%w: failed to initialise formatter: %v", err, name)
|
return fmt.Errorf("%w: failed to initialise formatter: %v", err, name)
|
||||||
@ -383,6 +383,7 @@ func applyFormatters(ctx context.Context) func() error {
|
|||||||
if matched {
|
if matched {
|
||||||
stats.Add(stats.Matched, 1)
|
stats.Add(stats.Matched, 1)
|
||||||
} else {
|
} else {
|
||||||
|
log.Debugf("no match found: %s", file.Path)
|
||||||
// no match, so we send it direct to the processed channel
|
// no match, so we send it direct to the processed channel
|
||||||
processedCh <- file
|
processedCh <- file
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user