-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (31 loc) · 1.64 KB
/
shellcheck.yml
File metadata and controls
36 lines (31 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Shellcheck
on: [push, pull_request, workflow_dispatch]
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Downloading shellcheck
shell: bash
run: |
tar_file='sh_ch.tar.xz'
wget -O ./"$tar_file" https://github.com/koalaman/shellcheck/releases/download/stable/shellcheck-stable.linux.x86_64.tar.xz
tar -xf ./"$tar_file"
rm ./"$tar_file"
- name: Checking scripts
shell: bash
run: |
readarray -t text_files < <(find -mindepth 1 -maxdepth 1 -type f ! -iname 'README.md' ! -iname 'thumbnail.jpg' ! -iname 'commands' | sort) ## commands exceptionally added
readarray -t bashes < <(printf '%s\n' "${text_files[@]}" | \grep -Ev '(\.py)$' | sort)
for b in "${bashes[@]}"; {
./shellcheck-stable/shellcheck --severity=error --color=always "$b"
# syntax: shellcheck -e SC1091 -e SC2154 -e SC2162 -e SC2015 --color=always
# shellcheck --severity=error --color=always
# SC1091 --> (info): Not following: *** was not specified as input (see shellcheck -x).
# SC2154 --> warning: *** is referenced but not assigned
# SC2162 --> note: read without -r will mangle backslashes.
# SC2015 --> (info): Note that A && B || C is not if-then-else. C may run when A is true.
# SC2034 --> warning: mem_free appears unused. Verify use (or export if used externally).
# SC2124 --> warning: Assigning an array to a string! Assign as array, or use * instead of @ to concatenate.
}