Skip to content

Commit 560ae04

Browse files
authored
Add shellcheck to pre-commit (#19361)
1 parent a357a68 commit 560ae04

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,5 +128,10 @@ repos:
128128
# but the integration only works if shellcheck is installed
129129
- "github.com/wasilibs/go-shellcheck/cmd/[email protected]"
130130

131+
- repo: https://github.com/shellcheck-py/shellcheck-py
132+
rev: v0.10.0.1
133+
hooks:
134+
- id: shellcheck
135+
131136
ci:
132137
skip: [cargo-fmt, dev-generate-all]

fuzz/init-fuzzer.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/bin/bash
2+
set -eu
23

34
# https://stackoverflow.com/a/246128/3549270
45
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

scripts/mypy_primer.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,33 @@ echo "Enabling mypy primer specific configuration overloads (see .github/mypy-pr
55
mkdir -p ~/.config/ty
66
cp .github/mypy-primer-ty.toml ~/.config/ty/ty.toml
77

8-
PRIMER_SELECTOR="$(paste -s -d'|' $PRIMER_SELECTOR)"
8+
PRIMER_SELECTOR="$(paste -s -d'|' "${PRIMER_SELECTOR}")"
99

1010
echo "new commit"
11-
git rev-list --format=%s --max-count=1 "$GITHUB_SHA"
11+
git rev-list --format=%s --max-count=1 "${GITHUB_SHA}"
1212

13-
MERGE_BASE="$(git merge-base "$GITHUB_SHA" "origin/$GITHUB_BASE_REF")"
14-
git checkout -b base_commit "$MERGE_BASE"
13+
MERGE_BASE="$(git merge-base "${GITHUB_SHA}" "origin/${GITHUB_BASE_REF}")"
14+
git checkout -b base_commit "${MERGE_BASE}"
1515
echo "base commit"
1616
git rev-list --format=%s --max-count=1 base_commit
1717

1818
cd ..
1919

20-
echo "Project selector: $PRIMER_SELECTOR"
20+
echo "Project selector: ${PRIMER_SELECTOR}"
2121
# Allow the exit code to be 0 or 1, only fail for actual mypy_primer crashes/bugs
2222
uvx \
2323
--from="git+https://github.com/hauntsaninja/mypy_primer@59509d48de6da6aaa4e3a2f5e338769bc471f2d7" \
2424
mypy_primer \
2525
--repo ruff \
2626
--type-checker ty \
2727
--old base_commit \
28-
--new "$GITHUB_SHA" \
28+
--new "${GITHUB_SHA}" \
2929
--project-selector "/($PRIMER_SELECTOR)\$" \
3030
--output concise \
31-
--debug > $DIFF_FILE || [ $? -eq 1 ]
31+
--debug > "${DIFF_FILE}" || [ $? -eq 1 ]
3232

3333
# Output diff with ANSI color codes
34-
cat $DIFF_FILE
34+
cat "${DIFF_FILE}"
3535

3636
# Remove ANSI color codes before uploading
37-
sed -ie 's/\x1b\[[0-9;]*m//g' $DIFF_FILE
37+
sed -ie 's/\x1b\[[0-9;]*m//g' "${DIFF_FILE}"

scripts/release/bump.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
#!/usr/bin/env bash
22

3+
# shellcheck disable=SC2016
34
echo 'This script has been removed, use `./scripts/release.sh` instead'

0 commit comments

Comments
 (0)