Separates out the logic for detecting changes from the logic for updating the cache, fixing the case where both `--fail-on-change` and `--no-cache` are enabled.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Co-authored-by: Jonas Chevalier <zimbatm@zimbatm.com>
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Separates global excludes processing from `Formatter.Wants`. This removes redundant processing of global excludes in each `Formatter.Wants` call.
If a file has been globally excluded, we do not emit an `on-unmatched` log message. This should help reduce as reported in #317.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
For each path we determine the list of formatters that are interested in formatting it. From there, we sort
the list of formatters first by priority (lower value, higher priority) and then by name (lexicographically).
With this information we create a batch key which is based on the unique sequence of formatters. When enough paths with the same sequence is ready we apply them in order to each formatter.
By default, with no special configuration, this model guarantees that a given path will only be processed by one formatter at a time.
If a user wishes to influence the order in which formatters are applied they can use the priority field.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
We were going to the trouble of resolving the command to an executable via the PATH but were not using that executable when executing the formatting command.
Signed-off-by: Brian McGee <brian@bmcgee.ie>
Replaces the `Before` config option with an optional `Pipeline` key.
This is used to group formatters together in the order in which they are specified within the config file.
Signed-off-by: Brian McGee <brian@bmcgee.ie>