Skip to content

Commit 87c2aab

Browse files
add shellcheck
1 parent ea4e8d3 commit 87c2aab

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
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@v4
14+
- name: Install ShellCheck
15+
run: sudo apt-get install -y shellcheck
16+
- name: Run shellcheck
17+
run: ./shellcheck.sh

.shellcheckrc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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+
# disable referenced but not assigned variables
13+
disable=SC2154
14+
15+
# dont follow source files
16+
disable=SC1091
17+
18+
# declare and assign seperately
19+
disable=SC2155
20+
21+
22+
# enforcement relaxations for magisk ash
23+
# these functionalities are supported by magisk ash
24+
# even if they are not posix shell compliant
25+
26+
# source instead of .
27+
disable=SC3046
28+
29+
# local function variables
30+
disable=SC3043
31+
32+
# &> redirection
33+
disable=SC3020
34+
35+
# IFS
36+
disable=SC3003

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ It contains many useability enhancements and all the major fixes needed to run `
99
![GitHub Global Download Counter](https://img.shields.io/github/downloads/programminghoch10/Viper4AndroidRepackaged/total?logo=github)
1010
![GitHub Latest Download Counter](https://img.shields.io/github/downloads/programminghoch10/Viper4AndroidRepackaged/latest/total?logo=github) \
1111
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/programminghoch10/ViPER4AndroidRepackaged/build.yml?logo=github%20actions&logoColor=white)
12+
[![GitHub Workflow ShellCheck Status](https://img.shields.io/github/actions/workflow/status/programminghoch10/ViPER4AndroidRepackaged/shellcheck.yml?logo=github%20actions&logoColor=white&label=shellcheck)](https://github.com/programminghoch10/ViPER4AndroidRepackaged/actions/workflows/shellcheck.yml)
1213
![GitHub commits since last release](https://img.shields.io/github/commits-since/programminghoch10/ViPER4AndroidRepackaged/latest?logo=git&logoColor=white)
1314
![GitHub last commit](https://img.shields.io/github/last-commit/programminghoch10/ViPER4AndroidRepackaged?logo=git&logoColor=white) \
1415
![GitHub Repo stars](https://img.shields.io/github/stars/programminghoch10/ViPER4AndroidRepackaged?style=social) \

shellcheck.sh

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

0 commit comments

Comments
 (0)