Skip to content

Commit 423d61a

Browse files
add shellcheck
1 parent a9b8e5e commit 423d61a

File tree

4 files changed

+58
-1
lines changed

4 files changed

+58
-1
lines changed

.github/workflows/shellcheck.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: ShellCheck
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
check:
9+
name: Check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v3
14+
- name: Install ShellCheck
15+
run: sudo apt-get install -y shellcheck
16+
- name: Run shellcheck
17+
run: ./shellcheck.sh

.shellcheckrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
# enable additional checks
3+
enable=add-default-case
4+
enable=avoid-nullary-conditions
5+
enable=check-set-e-suppressed
6+
enable=check-unassigned-uppercase
7+
enable=deprecate-which
8+
9+
# unused variable warning
10+
disable=SC2034
11+
12+
# cd fail
13+
disable=SC2164
14+
15+
# dont follow source files
16+
disable=SC1091
17+
18+
# unnecessary arithmetic variables style
19+
disable=SC2004
20+
21+
# variables in printf string
22+
# we use variables as constants for defining the pattern at the beginning of the file
23+
disable=SC2059

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ It will patch
2828
[any installed ReVanced compatible app](https://revanced.app/patches)
2929
right on your device during installation.
3030

31-
<a href="https://github.com/programminghoch10/ReVancedRepackaged/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/programminghoch10/ReVancedRepackaged/build.yml?logo=github%20actions&logoColor=white" alt="GitHub Workflow Status"></a>
31+
<a href="https://github.com/programminghoch10/ReVancedRepackaged/actions/workflows/build.yml"><img src="https://img.shields.io/github/actions/workflow/status/programminghoch10/ReVancedRepackaged/build.yml?logo=github%20actions&logoColor=white" alt="GitHub Workflow Build Status"></a>
32+
<a href="https://github.com/programminghoch10/ReVancedRepackaged/actions/workflows/shellcheck.yml"><img src="https://img.shields.io/github/actions/workflow/status/programminghoch10/ReVancedRepackaged/shellcheck.yml?logo=github%20actions&logoColor=white&label=shellcheck" alt="GitHub Workflow ShellCheck Status"></a>
33+
<br>
3234
<a href="https://github.com/programminghoch10/ReVancedRepackaged/commits/main"><img src="https://img.shields.io/github/last-commit/programminghoch10/ReVancedRepackaged?logo=git&logoColor=white" alt="GitHub last commit"></a>
3335
<a href="https://github.com/programminghoch10/ReVancedRepackaged/compare/"><img src="https://img.shields.io/github/commits-since/programminghoch10/ReVancedRepackaged/latest?logo=git&logoColor=white" alt="GitHub commits since last release"></a>
3436

shellcheck.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
export IFS=$'\n'
3+
[ -z "$(command -v shellcheck)" ] && echo "shellcheck not installed!" && exit 1
4+
shellcheck --version
5+
6+
SHELLCHECK_ARGS=()
7+
SHELLCHECK_ARGS+=(--wiki-link-count=256)
8+
9+
declare -a FILES
10+
mapfile -t FILES < <(find . -type f -name '*.sh')
11+
12+
shellcheck \
13+
"${SHELLCHECK_ARGS[@]}" \
14+
"$@" \
15+
"${FILES[@]}"

0 commit comments

Comments
 (0)