- Fixed a bug where error output was printed with debug formatting, which caused escaped ANSI codes and newlines to appear in the output. Fixed by Greg Oschwald (@oschwald). GH #90.
- Fixed a bug when calling
precious -c precious.toml, without a directory in the path to the config file. This would fail with an error likeFailed to run precious: No such file or directory. Reported by Olaf Alders (@oalders). GH #89.
- Removed support for the deprecated
run-modeandchdirconfig keys. See the docs on upgrading to the new configuration keys. - When running
precious config init, the top-levelexcludekey was incorrectly generated asexcludes. Fixed by @oalders (Olaf Alders). GH #84.
- Made all info-level logging truncate the command being run when the full command contains many paths. I missed some spots when I tried to do this in 0.8.0. This is a much more thorough change. GH #80.
- Added a new
--no-colorflag that suppresses all ANSI colors in the output. Requested by @danielcompton (Daniel Compton). GH #82. - Made the
--asciiflag global, so it can be used in all subcommands. This required removing the short flag-a, since that would conflict with the short flag for--all. - Made the
--quietflag global as well. - When the
--quietflag is set,preciouswill no longer print any output in the case where all commands succeed.
- Reduced the verbosity of the info-level logs (seen with the
--verboseflag). 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 CLI args that set the log level,
--verbose,--debug, and--trace, are now available on both the mainpreciouscommand, as well as all of its subcommands. This means you can now writeprecious lint --debug -ainstead ofprecious --debug lint -a. In order to support this without breaking subcommands, the--debugarg no longer has a short flag version, because-dwas already being used byprecious lintandprecious tidyfor the--git-diff-fromarg. GH #76. - When run with
--verboseor--debug,preciouswill print out a status message every 5 seconds when running a command. This makes it clearer that things are still running, rather than totally hung. GH #77.
- The generated config for Go projects no longer uses
golangci-lintfor code formatting. Instead, it is configured to usegofumpt. - The generated config for
golangci-lintcreates a config file named.golangci.ymlfile instead ofgolangci-lint.yml. This removes the need to pass the-Cfile togolangci-lint. - The generated config for Go projects does enable
golangci-lintas a tidier with its--fixflag. This is useful for applying fixes from various linters.
- Added
fixas an alias for thetidycommand. Implemented by Michael McClimon (@mmcclimon). GH #70. - Added
shellandtomlcomponents forprecious config --component ...options.
- Added an
--autoflag forprecious config init. If this is specified thenpreciouswill 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--componentargument was not required, when it should require at least one. If none were given it would create an emptyprecious.tomlfile. Reported by John Vandenberg (@jayvdb). GH #67. - Changed how
precious config initgenerates config for Perl. Theperlimportscommand is now the first one in the generated config. This is necessary becauseperlimportsmay change the code in a way thatperltidywill then change further. Runningperlimportsafterperltidymeant 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-yoptions. Fixes GH #65 and #66.
-
Added three new experimental
invokeoptions:invoke.per-file-or-dir = ninvoke.per-file-or-once = ninvoke.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-lintis 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_argsis nowpath-argsandok_exit_codesis 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
preciouswould exit with an exit code of1on errors that were not linting failures. Going forward, an exit code of1should only be used for linting failures. -
preciouswill now emit a warning if your config file uses any of the deprecated config keys,run_modeandchdir. 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 initand asking for the Perl or Rust components,preciouswould tell you to installomegasorteven though the generated config did not use it. Reported by Olaf Alders. GH #61. - If precious was run with
--stagedand 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.shscript created when runningprecious config init --component gois now executable. Reported by Olaf Olders. GH #56. - The generated config for Go now excludes the
vendordirectory 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--pathargument, 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 goagolangci-lint.ymlfile 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 initcommand that can generateprecious.tomlfor you. Suggested by Olaf Alders. GH #53.
- Help output is now line-wrapped based on your terminal width.
- Added a new
precious config listcommand 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
labelsin 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
--gitflag 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_modeorchdirwas 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_modeandchdirconfiguration 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
--gitand--stagedwhen 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
!inincludeandexcludekeys. This allow you to exclude the given pattern, even if matches previous rules in the list. See the Git docs on.gitignorepatterns for more details. Fixes GH #39. - When run in GitHub Actions,
preciouswill now emit GitHub annotations for linting errors.
- The
expect_stderrconfig parameter has been replaced byignore_stderr. This new parameter accepts one or more strings, which are turned into regexes. If the command'sstderroutput matches any of the regexes then it is ignore. The oldexpect_stderrparameter 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-stashflags, 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--allflag or an explicit list of files, it will still error if all of them are excluded.
- Added a
--commandflag to thelintandtidysubcommands. 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-stashflags, it will look for all files in the project, regardless of what directory you executepreciousin. - 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
--stagedmode 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-stashmode that provides the old--stagedbehavior. 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_modeasfilesandchdirastrue, the paths passed to the command would still include parent directories. Reported by Greg Oschwald. Fixes #25.
- Running precious with the
--stagedflag 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.tomlas 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 configin CI. This fixes #14, reported by Olaf Alders.
- Fixed config handling of a global
excludekey. 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 = truewas 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 = trueconfiguration, 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 stashunder the hood to only check the staged files, thengit stash popto restore things back to their original state. But runninggit stashcommand. 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.tomlfile 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.tomlfile 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_dirandrun_onceconfig flags with a singlerun_modeflag, 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
envconfig 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_flagtolint_flagsso it can now be an array of strings as well as a single string. - Added a
tidy_flagsoption as well. Now commands which are both must define eitherlint_flagsortidy_flags(or both).
- Fixed a bug where
git stashwould 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_onceflag for commands. This causes command to be run exactly once from the root directory of the project (when it applies). This lets you set yourincludeandexcluderules 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_dirset totruewould 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.