kevinlu1248 / armbian-build

The Armbian Linux Build Framework under Kreyren's Management
GNU General Public License v2.0
0 stars 0 forks source link

Sweep: Remove x-hack from shellcheck script #62

Open sweep-nightly[bot] opened 10 months ago

sweep-nightly[bot] commented 10 months ago

Parent issue: #11

Checklist - [X] `lib/tools/shellcheck.sh` ✅ Commit [`259886c`](https://github.com/kevinlu1248/armbian-build/commit/259886c208fd76875a57a282143f73066b83744a)
• Replace the line 'chmod +x "${SHELLCHECK_BIN}"' with 'chmod 755 "${SHELLCHECK_BIN}"' to explicitly set the file permissions to make the script executable.
Sandbox Execution Logs
trunk init 1/3 ✓
⡿ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
⣟ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
⣟ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
⣟ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
✔ Downloading Trunk 1.16.0... done
⡿ Verifying Trunk sha256...
✔ Verifying Trunk sha256... done
⡿ Unpacking Trunk...
✔ Unpacking Trunk... done

✔ 16 linters were enabled (.trunk/trunk.yaml)
  bandit 1.7.5 (57 python files)
  black 23.9.1 (57 python files)
  checkov 2.4.9 (3 json, 11 yaml files)
  git-diff-check (10143 files)
  isort 5.12.0 (57 python files) (created .isort.cfg)
  markdownlint 0.36.0 (12 markdown files) (created .markdownlint.yaml)
  nixpkgs-fmt 1.3.0 (2 nix files)
  oxipng 8.0.0 (27 png files)
  prettier 3.0.3 (3 html, 2 javascript, 3 json, 12 markdown, 11 yaml files)
  ruff 0.0.290 (57 python files) (created ruff.toml)
  shellcheck 0.9.0 (458 shell files) (created .shellcheckrc)
  shfmt 3.6.0 (458 shell files)
  svgo 3.0.2 (1 svg file) (created svgo.config.js)
  trivy 0.45.1 (11 yaml files)
  trufflehog 3.56.1 (10143 files)
  yamllint 1.32.0 (11 yaml files) (created .yamllint.yaml)
Next Steps
 1. Read documentation
    Our documentation can be found at https://docs.trunk.io
 2. Get help and give feedback
    Join the Trunk community at https://slack.trunk.io
trunk fmt lib/tools/shellcheck.sh 2/3 ✓

 ✔ Formatted lib/tools/shellcheck.sh
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix lib/tools/shellcheck.sh 3/3 ✓

  ISSUES  
lib/tools/shellcheck.sh:13:2
  13:2   medium  Use 'cd ... || exit' or 'cd ... || return' in case cd fails.                          shellcheck/SC2164
  22:7   low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  26:21  low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  31:7   low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  35:23  low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  60:19  low     Consider invoking this command separately to avoid masking its return value (or use   shellcheck/SC2312
                 '|| true' to ignore).                                                                                  
 111:36  low     Consider invoking this command separately to avoid masking its return value (or use   shellcheck/SC2312
                 '|| true' to ignore).                                                                                  
 112:35  low     Consider invoking this command separately to avoid masking its return value (or use   shellcheck/SC2312
                 '|| true' to ignore).                                                                                  
Checked 1 file
8 existing issues (5 auto-fixable)
sweep-nightly[bot] commented 10 months ago

Here's the PR! https://github.com/kevinlu1248/armbian-build/pull/64.

💎 Sweep Pro: I used GPT-4 to create this ticket. You have unlimited GPT-4 tickets.


Actions (click)


Step 1: 🔎 Searching

I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.

Some code snippets I looked at (click to expand). If some file is missing from here, you can mention the path in the ticket description. https://github.com/kevinlu1248/armbian-build/blob/e13c915efd6b71179224c064bd1c07fbbcb8b81b/lib/tools/shellcheck.sh#L1-L146

Step 2: ⌨️ Coding

trunk init 1/3 ✓
⡿ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
⣟ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
⣟ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
⣟ Downloading Trunk 1.16.0...
⡿ Downloading Trunk 1.16.0...
⢿ Downloading Trunk 1.16.0...
⣻ Downloading Trunk 1.16.0...
⣽ Downloading Trunk 1.16.0...
⣾ Downloading Trunk 1.16.0...
⣷ Downloading Trunk 1.16.0...
⣯ Downloading Trunk 1.16.0...
✔ Downloading Trunk 1.16.0... done
⡿ Verifying Trunk sha256...
✔ Verifying Trunk sha256... done
⡿ Unpacking Trunk...
✔ Unpacking Trunk... done

✔ 16 linters were enabled (.trunk/trunk.yaml)
  bandit 1.7.5 (57 python files)
  black 23.9.1 (57 python files)
  checkov 2.4.9 (3 json, 11 yaml files)
  git-diff-check (10143 files)
  isort 5.12.0 (57 python files) (created .isort.cfg)
  markdownlint 0.36.0 (12 markdown files) (created .markdownlint.yaml)
  nixpkgs-fmt 1.3.0 (2 nix files)
  oxipng 8.0.0 (27 png files)
  prettier 3.0.3 (3 html, 2 javascript, 3 json, 12 markdown, 11 yaml files)
  ruff 0.0.290 (57 python files) (created ruff.toml)
  shellcheck 0.9.0 (458 shell files) (created .shellcheckrc)
  shfmt 3.6.0 (458 shell files)
  svgo 3.0.2 (1 svg file) (created svgo.config.js)
  trivy 0.45.1 (11 yaml files)
  trufflehog 3.56.1 (10143 files)
  yamllint 1.32.0 (11 yaml files) (created .yamllint.yaml)
Next Steps
 1. Read documentation
    Our documentation can be found at https://docs.trunk.io
 2. Get help and give feedback
    Join the Trunk community at https://slack.trunk.io
trunk fmt lib/tools/shellcheck.sh 2/3 ✓

 ✔ Formatted lib/tools/shellcheck.sh
Re-checking autofixed files...

Checked 1 file
✔ No issues
trunk check --fix lib/tools/shellcheck.sh 3/3 ✓

  ISSUES  
lib/tools/shellcheck.sh:13:2
  13:2   medium  Use 'cd ... || exit' or 'cd ... || return' in case cd fails.                          shellcheck/SC2164
  22:7   low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  26:21  low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  31:7   low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  35:23  low     Prefer putting braces around variable references even when not strictly required.     shellcheck/SC2250
  60:19  low     Consider invoking this command separately to avoid masking its return value (or use   shellcheck/SC2312
                 '|| true' to ignore).                                                                                  
 111:36  low     Consider invoking this command separately to avoid masking its return value (or use   shellcheck/SC2312
                 '|| true' to ignore).                                                                                  
 112:35  low     Consider invoking this command separately to avoid masking its return value (or use   shellcheck/SC2312
                 '|| true' to ignore).                                                                                  
Checked 1 file
8 existing issues (5 auto-fixable)


Step 3: 🔁 Code Review

Here are my self-reviews of my changes at sweep/remove-x-hack_14.

Here is the 1st review

Thanks for your work on this issue. The 'x-hack' has been correctly replaced with an explicit command to set the file permissions, which is a great improvement. However, there's one change that needs to be addressed: - In `lib/tools/shellcheck.sh` on line 46, the double quotes around `${SHELLCHECK_BIN}` in the if condition have been removed. This could potentially cause problems if the path stored in `${SHELLCHECK_BIN}` contains spaces. Please add the double quotes back to ensure the script works correctly in all scenarios. Keep up the good work!

I finished incorporating these changes.


🎉 Latest improvements to Sweep:


💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord