Skip to content

Commit

Permalink
add shellcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
programminghoch10 committed Dec 31, 2023
1 parent a9b8e5e commit 423d61a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .github/workflows/shellcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: ShellCheck

on:
push:
pull_request:

jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install ShellCheck
run: sudo apt-get install -y shellcheck
- name: Run shellcheck
run: ./shellcheck.sh
23 changes: 23 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

# enable additional checks
enable=add-default-case
enable=avoid-nullary-conditions
enable=check-set-e-suppressed
enable=check-unassigned-uppercase
enable=deprecate-which

# unused variable warning
disable=SC2034

# cd fail
disable=SC2164

# dont follow source files
disable=SC1091

# unnecessary arithmetic variables style
disable=SC2004

# variables in printf string
# we use variables as constants for defining the pattern at the beginning of the file
disable=SC2059
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ It will patch
[any installed ReVanced compatible app](https://revanced.app/patches)
right on your device during installation.

<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>
<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>
<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>
<br>
<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>
<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>

Expand Down
15 changes: 15 additions & 0 deletions shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
export IFS=$'\n'
[ -z "$(command -v shellcheck)" ] && echo "shellcheck not installed!" && exit 1
shellcheck --version

SHELLCHECK_ARGS=()
SHELLCHECK_ARGS+=(--wiki-link-count=256)

declare -a FILES
mapfile -t FILES < <(find . -type f -name '*.sh')

shellcheck \
"${SHELLCHECK_ARGS[@]}" \
"$@" \
"${FILES[@]}"

0 comments on commit 423d61a

Please sign in to comment.