Skip to content

v1.0.0

Latest

Choose a tag to compare

@github-actions github-actions released this 05 Oct 14:17
· 2 commits to master since this release
Immutable release. Only release title and notes can be modified.
v1.0.0
1a11850

This 1.0.0 release does not contain any breaking changes, but it does contain many bug fixes. Going forward, this project will follow semver versioning.

  • When the precious config is in a subdirectory of a larger git project, it was inconsistent about what files it would consider. If given specific files or the --all flag, it only looked at files in or below the directory containing its config file. However, when given any flag which was git-related, including --git, --staged, --staged-with-stash, and --git-diff-from, precious saw changed files outside of this tree, which caused it to fail. Now precious only looks at changed files under the project root, which is the directory containing the precious config file. This also makes top-level exclude patterns anchored with a leading / work in these modes.
  • The invoke.per-file-or-dir, invoke.per-file-or-once, and invoke.per-dir-or-once options are now checked against the same rules as the two plain invoke modes they can turn into. Before, none of the checks for nonsensical combinations applied to them. For example, a command with invoke.per-dir-or-once = 2 and working-dir = "dir" was accepted. When it ran once, it only ran in the first file's directory, but precious reported every file as passing. This is a breaking change for any config with one of these combinations, which will now fail to load.
  • Fixed a bug where a command with type = "both" treated the lint-failure-exit-codes ok exit codes even when tidying. This meant that if the command exited with those codes when tidying, it was treated as successful. Now only the ok-exit-codes are ok when tidying, as the documentation says. If your tidier exits with one of these codes on a normal exit, add that code to its ok-exit-codes.
  • Fixed a bug where the --staged-with-stash mode popped the stash right after finding the files to check, before running any commands. Commands saw your unstaged changes, and a tidier could rewrite them. The stash is now popped after every command has run.
  • Fixed a bug where the --staged-with-stash mode would pop a stash that already existed when precious ran. When there were no unstaged changes, git made no new stash, but precious still ran git stash pop at the end, which applied and dropped your most recent stash.
  • Fixed a bug where a tidy command that runs once per directory was always reported as having tidied files, even when it changed no files. This affected commands with invoke = "per-dir", and commands with invoke.per-file-or-dir = n when the number of files was at or above the threshold. These commands now correctly report whether or not they've changed files.
  • Fixed a bug where working_dir.chdir_to and working-dir.chdir_to were rejected with a config parse error. Only the chdir-to spelling of this key was accepted. The underscore spelling stopped working in 0.10.0, even though the underscore names for config keys are meant to keep working.
  • Fixed the golangci-lint command in the config generated by precious config init for Go, and in examples/golang/precious.toml. The command was golangci-lint run -c --allow-parallel-runners. The -c flag takes a config file path, so golangci-lint tried to load a config file named --allow-parallel-runners and exited with an error. The -c flag has been removed.
  • The .golangci.yml file generated by precious config init for Go is now in the golangci-lint v2 format. The old file was in the v1 format, which v2 refuses to load.
  • Fixed the perltidy command in examples/perl/precious.toml. It used $PRECIOUS-ROOT instead of $PRECIOUS_ROOT for the path to the profile, so perltidy could not find its profile and every run failed. The config generated by precious config init was already correct.
  • The prettier-yaml command in the config generated by precious config init now includes **/*.yaml files as well as **/*.yml files. Before, files with a .yaml extension were never linted or tidied, even though finding one is enough for --auto to turn on the YAML component.
  • The perlimports command in the config generated by precious config init for Perl, and in examples/perl/precious.toml, now sets lint-failure-exit-codes = 1. Before, a file that failed perlimports --lint was reported as an unexpected exit code error and not as a lint failure.
  • The podchecker command in the config generated by precious config init for Perl, and in examples/perl/precious.toml, now ignores the stderr output that podchecker prints when it finds POD errors. Before, a file with POD errors was reported as an unexpected stderr error and not as a lint failure.
  • Fixed a bug on Windows where precious could run a different executable than the one it found in your PATH. Windows looks in its system directories before it looks in PATH. This meant that cmd = ["bash", ...] could run the WSL launcher in C:\Windows\System32 even when Git's bash came first in PATH. Now precious always runs the executable that it finds in PATH.
  • A relative path to an executable in cmd, like cmd = ["./node_modules/.bin/eslint"], is now always looked up relative to the project root. Before, it was looked up relative to the directory that precious was run in, so the command could not be found when you ran precious from a subdirectory. The configs generated by precious config init for TypeScript, Markdown, and YAML all use paths like this. An executable with no directory in it, like eslint, is still looked up in your PATH.
  • Fixed a bug where --staged-with-stash stashed unstaged changes in the middle of a cherry-pick or revert. The stash made git forget that the cherry-pick or revert was in progress, so git cherry-pick --continue failed and a plain git commit lost the original commit message. Now precious skips the stash in these cases, like it already did for a merge.
  • Fixed a bug where the --git, --staged, --staged-with-stash, and --git-diff-from flags skipped files that were renamed. A file that was moved and then edited was never linted or tidied under its new name.
  • Fixed a bug where the --git, --staged, --staged-with-stash, and --git-diff-from flags failed when git diff printed a warning. For example, with core.autocrlf turned on, git warns that "LF will be replaced by CRLF", and precious treated this as an error. Now precious only looks at the exit code from git diff.
  • Fixed a bug where a file with a name that is not valid UTF-8 made precious fail even when the file was excluded. Now precious only reports an error for a non-UTF-8 file name when the file is not excluded.
  • Fixed the exit code when a command fails to run properly. This covers a command that returns an exit code that is not listed as ok, prints to stderr unexpectedly, or cannot be executed. In these cases precious exited with 1, the same as for a lint failure, even though the docs said it would not. Now precious exits with 43, in both lint and tidy mode. If you have scripts that check for an exit code of 1 from precious tidy, you will need to update them.
  • Fixed a bug where a tidy command with invoke = "per-dir" failed when the directory had any file with a name that is not valid UTF-8, even a file that the command does not include. Now precious only reports an error for a non-UTF-8 file name when the file matches the command's include and exclude rules, and that error shows the raw bytes of the name.
  • A value of 0 for invoke.per-file-or-dir, invoke.per-file-or-once, or invoke.per-dir-or-once is now a config error. Before, the first two made precious panic when it ran the command, and the third was accepted and always ran the command once.
  • When precious walks the project to find files, it now skips anything that is not a regular file, like a socket, a FIFO, or a broken symlink. Before, these were passed to commands like any other file. A tidy command that matched one made precious panic, or fail with an error that said the path did not exist. If you pass one of these paths by name on the command line, a tidy command now fails with an error that says the path is not a regular file or a directory.
  • A command with an empty cmd, like cmd = [] or cmd = "", is now a config error. Before, cmd = [] made precious panic when it ran the command, and cmd = "" failed with an error about an executable that could not be found.
  • The --command flag now runs the named command whatever its labels are, unless --label is also passed. Before, --command on its own still only looked at commands with the default label. So a command with labels that did not include default could not be run by name alone, and precious said that no commands matched the name.
  • The check-go-mod.sh script that precious config init --component go creates now prints the output from go mod tidy when that command fails, and exits with 2. Before, the script exited with 1 and printed nothing, so precious reported a lint failure with no explanation.
  • Running precious config init --auto in a directory with no files that precious knows how to generate config for is now an error. Before, it wrote an empty precious.toml and exited with 0, and every later run of precious failed with an error about a missing commands field.
  • The config that precious config init --component shell generates no longer has exclude = ["target"]. That is the Rust build directory, and it has nothing to do with shell scripts. It made precious skip every directory named target for all commands.
  • Running precious config init --auto no longer looks at files under the .git, .hg, and .svn directories. Before, a git branch or tag with a name like release/notes.md or v1.pl made it generate config for Markdown or Perl, even when the project had no files of that type.
  • When the paths given on the command line overlap, each file is now only handled once. Before, a command like precious tidy . src/a.txt or precious lint a.txt a.txt passed the same file to a command more than once, and ran a per-file command on that file more than once.
  • Fixed a bug with a negated exclude pattern for a file inside an excluded directory, like exclude = ["vendor", "!vendor/keep.txt"]. When the directory was given on the command line, as in precious lint vendor, the file was not found and precious said that the path was excluded. The file was found with --all or when a parent directory was given.
  • A submodule with a new commit is no longer passed to commands when running with --git, --staged, --staged-with-stash, or --git-diff-from. Git reports the submodule as one changed path, and precious treated that directory as if it were a file.
  • When exactly one command failed, the summary line that precious printed had a NUL character in it, right after the word "Error". This made tools like grep treat the output as binary.
  • When a command's env sets PATH, precious now uses that PATH to find the command's executable. Before, it looked in its own PATH, so a command whose executable was only in the PATH from env failed with an error that said the executable could not be found.
  • When a command is killed by a signal, the error that precious prints now includes the command's stdout and stderr. Before, that output was thrown away.
  • When a command fails because it printed something unexpected to stderr, the error that precious prints now includes the command's stdout as well as its stderr.
  • Fixed the error message for an executable that cannot be found. It was missing the closing parenthesis after the PATH value.
  • Fixed the shortened command that precious shows in its --verbose output for a command that sets path-flag. It could end with a flag that had no path after it, and it reported the wrong number of paths left out.
  • Fixed a false warning in the --verbose output. When a command could not be started, precious logged "Got a disconnected error receiving message from main thread" next to the real error.
  • Fixed the dev/bin/check-go-mod.sh script that precious config init generates for Go projects. It used the output of go mod tidy -v as a printf format string, so a % or a backslash in that output could garble what the script printed.
  • Fixed the help output and the errors for bad command line arguments. The help had an empty Usage: line, and errors like "unexpected argument found" did not say which argument was wrong.
  • Fixed the path in the ::error file=... annotation that precious prints when it runs in GitHub Actions. The path was relative to the directory with the precious config file. When that was not the root of the repo, the annotation pointed at the wrong file. The path is now relative to GITHUB_WORKSPACE.
  • The ::error annotation that precious prints when it runs in GitHub Actions now escapes special characters in the file path and the command name. Before, a path that contained a character like ,, : or % gave an annotation that pointed at the wrong file.
  • The ::error annotation that precious prints when it runs in GitHub Actions no longer names a file when the command was not given file paths, for example with path-args = "none". Before, if only one file matched the command, the annotation was put on that file, even though the failure could have been in any file.
  • Fixed the paths that precious passes to a command when working-dir.chdir-to is a symlink or contains ... The paths were not relative to the directory that the command really ran in, so the command could not find the files.
  • When the working directory for a command does not exist, for example because of a bad working-dir.chdir-to value, the error now names that directory. Before, the error only named the command, so it looked like the executable was missing.
  • Errors in a command's config are now reported no matter which commands are selected to run. Before, some checks only ran for commands that matched the mode (lint or tidy), the --command flag, and the --label flag. This meant that precious lint would not report a tidy command with a bad invoke, working-dir, and path-args combination. The same was true for a bad ignore-stderr regex, a bad include or exclude glob, and the checks on lint-flags and tidy-flags.
  • The config that precious config init --component perl generates now uses ignore-stderr = ".*" for perlimports. Before, it used the deprecated expect-stderr = true. The two do the same thing.
  • When precious is run with --all and finds no files, the error no longer always says that everything was excluded in the precious config. It only says that when an exclude in the config dropped a file. Otherwise it says that no files were found, and that the directory may be empty or an ignore file such as .gitignore may exclude everything.