[PR #1018] [GitHub Actions] Introduce Shellcheck to check bash code #2805

Closed
opened 2025-11-20 05:31:55 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/community-scripts/ProxmoxVE/pull/1018

State: closed
Merged: Yes


✍️ Description

ShellCheck finds bugs in your shell scripts. It is an open source tool (https://github.com/koalaman/shellcheck) that runs analysis on your shell scripts.

As this project uses shell and bash intensively, automated checks that help humans avoid bugs may be helpful.


🛠️ Type of Change

Please check the relevant options:

  • Bug fix (non-breaking change that resolves an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change unexpectedly)
  • New script (a fully functional and thoroughly tested script or set of scripts)

Prerequisites

The following steps must be completed for the pull request to be considered:

  • Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.)
  • Testing performed (I have thoroughly tested my changes and verified expected functionality.)
  • Documentation updated (I have updated any relevant documentation)

📋 Additional Information (optional)

This PR might not be mergable from the get go as shellcheck throws a lot of errors on the repository itself.

Sometimes it throws "false positives" due to the way the scripts are written.
E.g. DISK${i}_REF vs. DISK1_REF:

In vm/ubuntu2404-vm.sh line 400:
  -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \
         ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting.
         ^----------^ SC2153 (info): Possible misspelling: DISK1_REF may not be assigned. Did you mean DISK_REF?

--
A full list of error codes and descriptions can be found here: https://www.shellcheck.net/wiki/

Those can be disables via

env:
    SHELLCHECK_OPTS: -e SC2059 -e SC2034 -e SC1090
**Original Pull Request:** https://github.com/community-scripts/ProxmoxVE/pull/1018 **State:** closed **Merged:** Yes --- ## ✍️ Description ShellCheck finds bugs in your shell scripts. It is an open source tool (https://github.com/koalaman/shellcheck) that runs analysis on your shell scripts. As this project uses shell and bash intensively, automated checks that help humans avoid bugs may be helpful. --- ## 🛠️ Type of Change Please check the relevant options: - [ ] Bug fix (non-breaking change that resolves an issue) - [X] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change unexpectedly) - [ ] New script (a fully functional and thoroughly tested script or set of scripts) --- ## ✅ Prerequisites The following steps must be completed for the pull request to be considered: - [X] Self-review performed (I have reviewed my code to ensure it follows established patterns and conventions.) - [ ] Testing performed (I have thoroughly tested my changes and verified expected functionality.) - [ ] Documentation updated (I have updated any relevant documentation) --- ## 📋 Additional Information (optional) This PR might not be mergable from the get go as shellcheck throws a lot of errors on the repository itself. Sometimes it throws "false positives" due to the way the scripts are written. E.g. `DISK${i}_REF` vs. `DISK1_REF`: ``` In vm/ubuntu2404-vm.sh line 400: -scsi0 ${DISK1_REF},${DISK_CACHE}${THIN}size=2G \ ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----------^ SC2153 (info): Possible misspelling: DISK1_REF may not be assigned. Did you mean DISK_REF? ``` -- A full list of error codes and descriptions can be found here: https://www.shellcheck.net/wiki/ Those can be disables via ``` env: SHELLCHECK_OPTS: -e SC2059 -e SC2034 -e SC1090 ```
saavagebueno added the pull-request label 2025-11-20 05:31:55 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/ProxmoxVE#2805