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

Closed
opened 2026-02-26 13:31:59 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/community-scripts/ProxmoxVE/pull/1018
Author: @andygrunwald
Created: 12/26/2024
Status: Merged
Merged: 12/26/2024
Merged by: @MickLesk

Base: mainHead: github-action-shellcheck


📝 Commits (1)

  • dd24b26 [GitHub Actions] Introduce Shellcheck to check bash code

📊 Changes

1 file changed (+25 additions, -0 deletions)

View changed files

.github/workflows/shellcheck.yml (+25 -0)

📄 Description

✍️ 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

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/community-scripts/ProxmoxVE/pull/1018 **Author:** [@andygrunwald](https://github.com/andygrunwald) **Created:** 12/26/2024 **Status:** ✅ Merged **Merged:** 12/26/2024 **Merged by:** [@MickLesk](https://github.com/MickLesk) **Base:** `main` ← **Head:** `github-action-shellcheck` --- ### 📝 Commits (1) - [`dd24b26`](https://github.com/community-scripts/ProxmoxVE/commit/dd24b26e31f0dbbac831fda16579e6f1d5bc6fdb) [GitHub Actions] Introduce Shellcheck to check bash code ### 📊 Changes **1 file changed** (+25 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `.github/workflows/shellcheck.yml` (+25 -0) </details> ### 📄 Description ## ✍️ 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 ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-26 13:31:59 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/ProxmoxVE#2971
No description provided.