- Reduced the verbosity of the info-level logs (seen with the
--verbose
flag). Previously, this would print out all the files a command was operating on, which could be hundreds of files. Now it will only print a summary of the files. Similarly, info-level logs of the commands being run omit all of the paths if there is more than one path in the command being executed. Debug-level logs still include the full command.
- The generated config for Go projects no longer uses
golangci-lint
for code formatting. Instead, it is configured to usegofumpt
. - The generated config for
golangci-lint
creates a config file named.golangci.yml
file instead ofgolangci-lint.yml
. This removes the need to pass the-C
file togolangci-lint
. - The generated config for Go projects does enable
golangci-lint
as a tidier with its--fix
flag. This is useful for applying fixes from various linters.
- Added
fix
as an alias for thetidy
command. Implemented by Michael McClimon (@mmcclimon). GH #70. - Added
shell
andtoml
components forprecious config --component ...
options.
- Added an
--auto
flag forprecious config init
. If this is specified thenprecious
will look at all the files in your project and generate config based on the types of files it finds. Suggested by John Vandenberg (@jayvdb). GH #67. - Fixed a bug when running
precious config init
. The--component
argument was not required, when it should require at least one. If none were given it would create an emptyprecious.toml
file. Reported by John Vandenberg (@jayvdb). GH #67. - Changed how
precious config init
generates config for Perl. Theperlimports
command is now the first one in the generated config. This is necessary becauseperlimports
may change the code in a way thatperltidy
will then change further. Runningperlimports
afterperltidy
meant that tidying Perl code could leave the code in a state where it fails linting checks. Implemented by Olaf Alders (@oalders). GH #68. - Added/cleaned up some debugging output for the new
invoke.per-x-or-y
options. Fixes GH #65 and #66.
-
Added three new experimental
invoke
options:invoke.per-file-or-dir = n
invoke.per-file-or-once = n
invoke.per-dir-or-once = n
These will run the command in different ways depending on how many files or directories match the command's config. This lets you pick the fastest way to run commands that can be invoked in more than one way. For example, if you're in a large repo and have only made changes to files in a few directories,
golangci-lint
is much faster when run once per directory. But once the number of directories is large enough, it's faster to just run it once on the whole repo. -
All config keys have been changed to use dashes instead of underscores, so for example
path_args
is notpath-args
andok_exit_codes
is nowok-exit-codes
. However, the names with underscores will continue to work. I do not intend to ever deprecate the underscore version. They simply will not be used in the docs and examples. -
Fixed cases where
precious
would exit with an exit code of1
on errors that were not linting failures. Going forward, an exit code of1
should only be used for linting failures. -
precious
will now emit a warning if your config file uses any of the deprecated config keys,run_mode
andchdir
. Support for these options will be removed entirely in a future release.
- Added a
--git-diff-from <REF>
option that will find all files changed in the diff between<REF>
and the currentHEAD
. Requested by Michael McClimon. GH #64.
- When running
precious config init
and asking for the Perl or Rust components,precious
would tell you to installomegasort
even though the generated config did not use it. Reported by Olaf Alders. GH #61. - If precious was run with
--staged
and a file that was staged had been deleted from the filesystem but not removed withgit rm
, it would exit with a very unhelpful error likeError: No such file or directory (os error 2)
, without any indication of what the file was. Now it will simply ignore such a deleted file, though it will log a debug-level message saying that the file is being ignored. GH #63.
- When printing the results of running a command that was invoked with a long list of paths, the output will now summarize the paths affected instead of always printing all of them. GH #60.
- The
dev/bin/check-go-mod.sh
script created when runningprecious config init --component go
is now executable. Reported by Olaf Olders. GH #56. - The generated config for Go now excludes the
vendor
directory for all commands. Implemented by Olaf Alders. GH #57. - When running
precious config init
, it would overwrite an existing file if it was given a--path
argument, but not if the argument was left unset. Now it will always error out instead of overwriting an existing file. Reported by Olaf Alders. GH #58. - When running
precious config init --component go
agolangci-lint.yml
file will also be created. GH #59. - As of this release there are no longer binaries built for MIPS on Linux. These targets have been demoted to tier 3 support by the Rust compiler.
- Added a new
precious config init
command that can generateprecious.toml
for you. Suggested by Olaf Alders. GH #53.
- Help output is now line-wrapped based on your terminal width.
- Added a new
precious config list
command that prints a table showing all the commands in your config file. Requested by Olaf Alders. GH #52.
- Added a new labels feature. This allows you to group commands in your config file by assigning one
or more
labels
in their config. Then when runningprecious
, you can run commands with a specific label:precious lint --label some-label --all
. Suggested by Greg Oschwald. Addresses #8.
- The
--git
flag did not include any staged files, only files that were modified but not staged. It now includes all modified files, whether or not they're staged.
- The previous release didn't handle all of the old config keys correctly. If just
run_mode
orchdir
was set, but not both, it may not have replicated the behavior of precious v0.3.0 and earlier with the same settings.
- This release has huge changes to how commands are invoked. The old
run_mode
andchdir
configuration keys have been deprecated. In the future, using these will cause precious to print a warning, and later support will be removed entirely. See the documentation for more details. There are also some docs on upgrading from previous versions. - Fixed path handling for
--git
and--staged
when the project root (the directory containing the precious config file) is a subdirectory of the git repo root. Previously this would just attempt to run against incorrect paths. - Precious now supports patterns starting with
!
ininclude
andexclude
keys. This allow you to exclude the given pattern, even if matches previous rules in the list. See the Git docs on.gitignore
patterns for more details. Fixes GH #39. - When run in GitHub Actions,
precious
will now emit GitHub annotations for linting errors.
- The
expect_stderr
config parameter has been replaced byignore_stderr
. This new parameter accepts one or more strings, which are turned into regexes. If the command'sstderr
output matches any of the regexes then it is ignore. The oldexpect_stderr
parameter will continue to work for now, but it is no longer documented. To replicate the old behavior simply setignore_stderr = ".*"
.
- When given the ,
--git
,--staged
, or--staged-with-stash
flags, precious would error out if all the relevant files were excluded. This is likely to break commit hooks so this is no longer an error. However, if given either the--all
flag or an explicit list of files, it will still error if all of them are excluded.
- Added a
--command
flag to thelint
andtidy
subcommands. If this is passed, then only the command with the given name will be run. This addresses #31, requested by Olaf Alders.
- The way precious works when run in a subdirectory of the project root has changed.
- When given the
--all
,--git
,--staged
, or--staged-with-stash
flags, it will look for all files in the project, regardless of what directory you executeprecious
in. - When given relative paths to files it will do the right thing. Previously it would error out with "No such file or directory". Reported by Greg Oschwald. Fixes #29.
- When given the
- The
--staged
mode no longer tries to stash unstaged content before linting or tidying files. This can cause a number of issues, and shouldn't be the default. There is a new--staged-with-stash
mode that provides the old--staged
behavior. Reported by Greg Oschwald. Fixes #30.
- If a command sent output to stdout, but not stderr, and exited with an unexpected error code, then the output to stdout would not be shown by precious in the error message. Reported by Greg Oschwald. Fixes #28.
- All binaries now statically link musl instead of the system libc.
- Added a number of new platforms for released binaries: Linux ARM 32-bit and 64-bit, and macOS ARM 64-bit.
- When a command unexpectedly prints to stderr the error message we print now includes both stdout and stderr from that command. Reported by Greg Oschwald. Fixes #26.
- When a command was configured with the
run_mode
asfiles
andchdir
astrue
, the paths passed to the command would still include parent directories. Reported by Greg Oschwald. Fixes #25.
- Running precious with the
--staged
flag would exit with an error if a post-checkout hook wrote any output to stderr. It appears that any output from a hook to stdout ends up on stderr for some reason, probably related to https://github.com/git/git/commit/e258eb4800e30da2adbdb2df8d8d8c19d9b443e4. Based on PR#24 by Olaf Alders. Fixes #23.
- Relaxed some dependencies for the benefit of packaging precious for Debian. Implemented by Jonas Smedegaard.
- Added support for
.precious.toml
as a config name. Based on PR#21 by Olaf Alders. Fixes #13.
- The order of commands in the config file is now preserved, and commands are executed in the order in which they appear in the config file. This addresses #12, requested by Olaf Alders.
- Fixed the tests so that they set the default branch name when running
git init
, rather than setting this viagit config
. This lets anyone run the tests, whereas it was only safe to set this viagit config
in CI. This fixes #14, reported by Olaf Alders.
- Fixed config handling of a global
exclude
key. The previous release did not handle a single string as that key's value, only an array.
- The verbose and debugging level output now includes timing information on each linter and tidier that is run. This is helpful if you want to figure out why linting or tidying is slower than expected.
- Fixed a bug in the debug output. It was not showing the correct cwd for commands where
chdir = true
was set. It always showed the project root directory instead of the directory where the command was run. It was running these commands in the right directory. This was solely a bug in the debug output.
- Fixed a bug in 0.0.10 where when not running with
--debug
, precious would not honor theexpect_stderr = true
configuration, and would instead unconditionally treat stderr output as an error.
- Errors are now printed out a bit differently, and in particular errors when trying to execute a command (not in the path, command fails unexpectedly, etc.) should be more readable now.
- When running any commands, precious now explicitly checks to see if the executable is in your
PATH
. If it's not it prints a new error for this case, as opposed to when running the executable produces an error. This partially addresses #10.
- Added a --jobs (-j) option for all subcommands. This lets you limit how many parallel threads are run. The default is to run one thread per available core. Requested by Shane Warden. GH #7.
- Fixed a bug where running precious in "git staged mode" (
precious lint --staged
) would cause breakage with merge commits that were the result of resolving a merge conflict. Basically, you'd get the commit but git would no longer know it was merging a commit, because precious was runninggit stash
under the hood to only check the staged files, thengit stash pop
to restore things back to their original state. But runninggit stash
command. There's some discussion of this on Stack Overflow but apparently it's still an issue with git today. Reported by Carey Hoffman. GH #9.
- Added a summary when there are problems linting or tidying files. Previously, when there were any
errors, the last thing precious printed out would be something like
[precious::precious][ERROR] Error when linting files
. Now it also includes a summary of what filter failed on each path. This is primarily useful for linting, as tidy failures are typically failures to execute the tidy command.
- Look for a
precious.toml
file in the current directory before trying to find one in the root of the current VCS checkout. - Use the current directory as the root for finding files, rather than the VCS checkout root.
- When a filter command does not exist, the error output now shows the full command that was run, including any arguments. Fixes GH #6.
- Precious can now be run outside of a VCS repo, as long as there is a
precious.toml
file in the current directory. There is probably more work to be done for precious to not expect to be run inside a VCS repo. - Fixed a bug where lint failures would still result in precious exiting with 0. I'm not sure when this bug was introduced.
- Replaced deprecated failure and failure_derive crates with anyhow and thiserror.
- Replaced the
on_dir
andrun_once
config flags with a singlerun_mode
flag, which can be one of "files" (the default)", "dirs", or "root". If the mode is "root" then the command runs exactly once from the root of the project. - Added an
env
config key for filters. This allows you to define env vars that will be set when the filter's command is run.
- Renamed the config key
lint_flag
tolint_flags
so it can now be an array of strings as well as a single string. - Added a
tidy_flags
option as well. Now commands which are both must define eitherlint_flags
ortidy_flags
(or both).
- Fixed a bug where
git stash
would be run multiple times in staged mode if you had more than one filter defined. As a bonus this also makes precious more efficient by not retrieving the list of files to check more than once.
- Add a
run_once
flag for commands. This causes command to be run exactly once from the root directory of the project (when it applies). This lets you set yourinclude
andexclude
rules based on files properly. Previously you would have to setinclude = "."
and the command would run when any files changed, even files which shouldn't trigger a run. - Fixed a bug where a command with
on_dir
set totrue
would incorrectly be run when a file matched both an include and exclude rule. Exclude rules should always win in these situations.
- Documentation fixes
- First release upon an unsuspecting world.