Skip to content

Commit 741d885

Browse files
committed
tools: Update tidy.sh
1 parent 3ed3be0 commit 741d885

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

tools/tidy.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ trap -- 'printf >&2 "%s\n" "${0##*/}: trapped SIGINT"; exit 1' SIGINT
77
cd -- "$(dirname -- "$0")"/..
88

99
# USAGE:
10-
# GH_TOKEN=$(gh auth token) ./tools/tidy.sh
10+
# GITHUB_TOKEN=$(gh auth token) ./tools/tidy.sh
1111
#
1212
# Note: This script requires the following tools:
1313
# - git 1.8+
1414
# - jq 1.6+
1515
# - npm (node 18+)
16-
# - python 3.6+, pipx
16+
# - python 3.6+, uv
1717
# - shfmt
1818
# - shellcheck
1919
# - zizmor
@@ -136,8 +136,8 @@ py_suffix=''
136136
if type -P python3 >/dev/null; then
137137
py_suffix=3
138138
fi
139-
yq() { pipx run yq "$@"; }
140-
tomlq() { pipx run --spec yq tomlq "$@"; }
139+
yq() { uvx yq "$@"; }
140+
tomlq() { uvx --from yq tomlq "$@"; }
141141
case "$(uname -s)" in
142142
Linux)
143143
if [[ "$(uname -o)" == 'Android' ]]; then
@@ -190,8 +190,8 @@ case "$(uname -s)" in
190190
else
191191
jq() { command jq "$@" | tr -d '\r'; }
192192
fi
193-
yq() { pipx run yq "$@" | tr -d '\r'; }
194-
tomlq() { pipx run --spec yq tomlq "$@" | tr -d '\r'; }
193+
yq() { uvx yq "$@" | tr -d '\r'; }
194+
tomlq() { uvx --from yq tomlq "$@" | tr -d '\r'; }
195195
fi
196196
fi
197197
;;
@@ -248,7 +248,7 @@ if [[ ${#rust_files[@]} -gt 0 ]]; then
248248
info "checking Rust code style"
249249
check_config .rustfmt.toml "; consider adding with reference to https://github.com/taiki-e/cargo-hack/blob/HEAD/.rustfmt.toml"
250250
check_config .clippy.toml "; consider adding with reference to https://github.com/taiki-e/cargo-hack/blob/HEAD/.clippy.toml"
251-
if check_install cargo jq pipx; then
251+
if check_install cargo jq uv; then
252252
# `cargo fmt` cannot recognize files not included in the current workspace and modules
253253
# defined inside macros, so run rustfmt directly.
254254
# We need to use nightly rustfmt because we use the unstable formatting options of rustfmt.
@@ -833,7 +833,7 @@ elif check_install shellcheck; then
833833
# Exclude SC2096 due to the way the temporary script is created.
834834
shellcheck_exclude=SC2086,SC2096,SC2129
835835
info "running \`shellcheck --exclude ${shellcheck_exclude}\` for scripts in .github/workflows/*.yml and **/action.yml"
836-
if check_install jq python3 pipx; then
836+
if check_install jq python3 uv; then
837837
shellcheck_for_gha() {
838838
local text=$1
839839
local shell=$2
@@ -988,7 +988,8 @@ if [[ ${#zizmor_targets[@]} -gt 0 ]]; then
988988
if [[ "${ostype}" =~ ^(netbsd|openbsd|dragonfly|illumos|solaris)$ ]] && [[ -n "${CI:-}" ]] && ! type -P zizmor >/dev/null; then
989989
warn "this check is skipped on NetBSD/OpenBSD/Dragonfly/illumos/Solaris due to installing zizmor is hard on these platform"
990990
elif check_install zizmor; then
991-
# zizmor can also be used via pipx, but old version will be installed if glibc version is old.
991+
# zizmor can also be used via uvx, but old version will be installed if glibc version is old.
992+
# Do not use `zizmor -q .` here because it also attempts to check submodules.
992993
IFS=' '
993994
info "running \`zizmor -q ${zizmor_targets[*]}\`"
994995
IFS=$'\n\t'
@@ -1045,7 +1046,7 @@ fi
10451046
if [[ -f .cspell.json ]]; then
10461047
info "spell checking"
10471048
project_dictionary=.github/.cspell/project-dictionary.txt
1048-
if check_install npm jq pipx; then
1049+
if check_install npm jq uv; then
10491050
has_rust=''
10501051
if [[ -n "$(ls_files '*Cargo.toml')" ]]; then
10511052
has_rust=1

0 commit comments

Comments
 (0)