Skip to content

Commit 5cc7afc

Browse files
committed
Shellcheck
1 parent 59de1db commit 5cc7afc

File tree

6 files changed

+18
-7
lines changed

6 files changed

+18
-7
lines changed

.pre-commit-config.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ repos:
5555
hooks:
5656
- id: yamllint
5757
name: "YAML linting"
58+
- repo: https://github.com/shellcheck-py/shellcheck-py
59+
rev: v0.10.0.1
60+
hooks:
61+
- id: shellcheck
62+
name: "Shell checking"
63+
args:
64+
- --external-sources
5865
- repo: https://github.com/cdce8p/python-typing-update
5966
rev: v0.7.2
6067
hooks:

scripts/complexity.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ set -eu
44
my_path=$(git rev-parse --show-toplevel)
55

66
if [ -n "${VIRTUAL_ENV-}" ] && [ -f "${VIRTUAL_ENV}/bin/activate" ]; then
7+
# shellcheck disable=SC1091 # ingesting virtualenv
78
. "${VIRTUAL_ENV}/bin/activate"
89
else
910
# other common virtualenvs
1011
my_path=$(git rev-parse --show-toplevel)
1112

1213
for venv in venv .venv .; do
1314
if [ -f "${my_path}/${venv}/bin/activate" ]; then
15+
# shellcheck disable=SC1090 # ingesting virtualenv
1416
. "${my_path}/${venv}/bin/activate"
1517
break
1618
fi

scripts/run-in-env.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,15 @@ if [ -s .python-version ]; then
1515
fi
1616

1717
if [ -n "${VIRTUAL_ENV-}" ] && [ -f "${VIRTUAL_ENV}/bin/activate" ]; then
18+
# shellcheck disable=SC1091 # ingesting virtualenv
1819
. "${VIRTUAL_ENV}/bin/activate"
1920
else
2021
# other common virtualenvs
2122
my_path=$(git rev-parse --show-toplevel)
2223

2324
for venv in venv .venv .; do
2425
if [ -f "${my_path}/${venv}/bin/activate" ]; then
26+
# shellcheck disable=SC1090 # ingesting virtualenv
2527
. "${my_path}/${venv}/bin/activate"
2628
break
2729
fi

scripts/setup.sh

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/usr/bin/env bash
2-
# 20250613 Copied from HA-core and adjusted
2+
# 20250613 Copied from HA-core and shell-check adjusted and modified for local use
33
set -e
44

5-
my_path=$(git rev-parse --show-toplevel)
6-
7-
if [ ! -n "$VIRTUAL_ENV" ]; then
5+
if [ -z "$VIRTUAL_ENV" ]; then
86
if [ -x "$(command -v uv)" ]; then
97
uv venv venv
108
else

scripts/setup_test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
#!/usr/bin/env bash
2-
# 20250613 Copied from HA-core and adjusted
2+
# 20250613 Copied from HA-core and shell-check adjusted and modified for local use
33
set -e
44

55
my_path=$(git rev-parse --show-toplevel)
66

7-
if [ ! -n "$VIRTUAL_ENV" ]; then
7+
if [ -z "$VIRTUAL_ENV" ]; then
88
if [ -x "$(command -v uv)" ]; then
99
uv venv venv
1010
else

scripts/tests_and_coverage.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env sh
1+
#!/usr/bin/env bash
22
# 20250613 Copied from HA-Core: run-in-env.sh
33
set -eu
44

@@ -15,13 +15,15 @@ if [ -s .python-version ]; then
1515
fi
1616

1717
if [ -n "${VIRTUAL_ENV-}" ] && [ -f "${VIRTUAL_ENV}/bin/activate" ]; then
18+
# shellcheck disable=SC1091 # ingesting virtualenv
1819
. "${VIRTUAL_ENV}/bin/activate"
1920
else
2021
# other common virtualenvs
2122
my_path=$(git rev-parse --show-toplevel)
2223

2324
for venv in venv .venv .; do
2425
if [ -f "${my_path}/${venv}/bin/activate" ]; then
26+
# shellcheck disable=SC1090 # ingesting virtualenv
2527
. "${my_path}/${venv}/bin/activate"
2628
break
2729
fi

0 commit comments

Comments
 (0)