Skip to content

Commit

Permalink
Add ShellCheck for OCI package scripts (#154)
Browse files Browse the repository at this point in the history
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/DocSpace-buildtools/pulls/154
Reviewed-by: Evgeniy Antonyuk <[email protected]>
Co-authored-by: Vladimir Ischenko <[email protected]>
Co-committed-by: Vladimir Ischenko <[email protected]>
  • Loading branch information
isboston authored and evgeniy-antonyuk committed Jan 20, 2025
1 parent 49c8c4d commit 829eb38
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/ci-oci-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,14 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: "Checking scripts for errors"
run: |
set -eux
sudo apt-get install -y shellcheck
find install/OneClickInstall tests -type f -name "*.sh" ! -path "install/OneClickInstall/install-Docker.sh" \
| xargs shellcheck --exclude="$(awk '!/^#|^$/ {print $1}' tests/lint/sc_ignore | paste -sd ",")" --severity=warning | tee sc_output
awk '/\(warning\):/ {w++} /\(error\):/ {e++} END {if (w+e) printf "::warning ::ShellCheck detected %d warnings and %d errors\n", w+0, e+0}' sc_output
- name: Set up Python 3.
uses: actions/setup-python@v5
with:
Expand Down
15 changes: 15 additions & 0 deletions tests/lint/sc_ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# ShellCheck can't follow non-constant source. Used for dynamically sourcing scripts.
SC1090 # Example: source <(curl -fsSL "${DOWNLOAD_URL_PREFIX}/uninstall.sh")

# Variable appears unused. May be used indirectly or exported.
SC2034 # Example: INSTALLATION_TYPE="${2^^}"

# Quote to prevent word splitting. Not quoted due to intentional command behavior.
SC2046 # Example: ${package_manager} -y install $([ "$DIST" != "fedora" ] && echo "epel-release")

# Variable referenced but not assigned. Likely set dynamically or externally.
SC2154 # Example: echo "${product}"

# Declare and assign separately to avoid masking return values. Combined for simplicity.
SC2155 # Example: local AVAILABLE_DISK_SPACE=$(df -m / | tail -1 | awk '{ print $4 }')

0 comments on commit 829eb38

Please sign in to comment.