Skip to content

Commit 2c201e1

Browse files
authored
Merge pull request #13 from austinvazquez/add-shellcheck-and-resolve-warnings
Add shellcheck to CI and resolve warnings
2 parents bf66c6b + 591ce0d commit 2c201e1

3 files changed

Lines changed: 32 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: CI
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
permissions:
9+
contents: read
10+
pull-requests: read
11+
12+
jobs:
13+
lint:
14+
name: Lint
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Install shellcheck
21+
run: |
22+
scversion="v0.10.0"
23+
wget -qO- "https://github.com/koalaman/shellcheck/releases/download/${scversion?}/shellcheck-${scversion?}.linux.x86_64.tar.xz" | tar -xJv
24+
echo "${PWD}/shellcheck-${scversion}/shellcheck" >> ${GITHUB_PATH}
25+
26+
- name: Shellcheck
27+
run: |
28+
shellcheck ./script/validate/dco ./script/validate/fileheader ./script/validate/vendor

script/validate/dco

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fi
2626
verbosity="${DCO_VERBOSITY--v}"
2727
range=
2828
commit_range="${DCO_RANGE-}"
29-
[ ! -z "${commit_range}" ] && {
29+
[ -n "${commit_range}" ] && {
3030
range="-range ${commit_range}"
3131
}
32-
GIT_CHECK_EXCLUDE="./vendor:./script/validate/template" git-validation ${verbosity} ${range} -run DCO,short-subject,dangling-whitespace
32+
GIT_CHECK_EXCLUDE="./vendor:./script/validate/template" git-validation "${verbosity}" "${range}" -run DCO,short-subject,dangling-whitespace

script/validate/vendor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ DIFF_PATH="vendor/ go.mod go.sum"
3838
# need word splitting here to avoid reading the whole DIFF_PATH as one pathspec
3939
#
4040
# shellcheck disable=SC2046
41-
DIFF=$(git status --porcelain -- $DIFF_PATH)
42-
DIFF_CONTENT=$(git diff -- $DIFF_PATH)
41+
DIFF=$(git status --porcelain -- "${DIFF_PATH}")
42+
DIFF_CONTENT=$(git diff -- "${DIFF_PATH}")
4343

4444
if [ "$DIFF" ]; then
4545
echo

0 commit comments

Comments
 (0)