Skip to content

fix(uninstall): redirect is not valid on a for-list - #320

Open
hyperpolymath wants to merge 1 commit into
mainfrom
fix/shellcheck-parse-error
Open

fix(uninstall): redirect is not valid on a for-list#320
hyperpolymath wants to merge 1 commit into
mainfrom
fix/shellcheck-parse-error

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Line 469 wrote 'for item in $cache_path 2>/dev/null; do'. A redirection cannot be applied to a for-list, so the file did not parse. Removed the redirect; the guard inside the loop already handles a missing path.

Found by an estate-wide shellcheck sweep of 5,111 tracked scripts across 375 repos. This file was one of 11 that fail to parse (SC1073/SC1072) — shellcheck stops analysing at the failure, so everything after it was never checked either.

Verified: shellcheck -S error now reports 0 findings for this file.

Line 469 wrote 'for item in $cache_path 2>/dev/null; do'. A redirection cannot be applied to a for-list, so the file did not parse. Removed the redirect; the guard inside the loop already handles a missing path.

Found by an estate-wide shellcheck sweep of 5,111 tracked scripts across 375
repos. This file was one of 11 that fail to PARSE (SC1073/SC1072) — shellcheck
stops analysing at the failure, so anything after it was never checked either.

Verified: shellcheck -S error now reports 0 findings for this file.
@coderabbitai

coderabbitai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5f8d89d1-5c2d-4113-9aa6-2e4e7e76ea77

📥 Commits

Reviewing files that changed from the base of the PR and between b2c4e73 and 55bddf4.

📒 Files selected for processing (1)
  • scripts/management/uninstall.sh

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (1)
scripts/management/uninstall.sh (1)

469-469: LGTM!


📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Improved cache cleanup during uninstallation by ensuring matching files are processed correctly and cleanup errors are handled more reliably.

Walkthrough

The uninstall script now expands the cache-cleanup glob directly in cleanup_cache without redirecting pathname expansion errors.

Changes

Cache cleanup

Layer / File(s) Summary
Cache glob expansion
scripts/management/uninstall.sh
cleanup_cache now iterates over the expanded cache glob without redirecting pathname expansion errors.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 55bdd

This localized fix restores parsing for the uninstall script without changing its intended guard behavior. No actionable merge-blocking risk remains beyond normal checks and review.

Poem

A rabbit checks the cache with care
The glob now expands in open air
No hidden errors drift away
The cleanup runs its simple way
Soft paws approve the change today

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the uninstall script fix and the invalid redirection in the for-list.
Description check ✅ Passed The description accurately explains the parsing error, the code change, the existing guard, and the ShellCheck verification.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@gitar-bot

gitar-bot Bot commented Aug 26, 2026

Copy link
Copy Markdown

Important

You are using the Gitar free plan. Upgrade to unlock code review, CI analysis, auto-apply, custom automations, and more.

Gitar

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR successfully resolves the syntax error caused by invalid redirection on the loop header. However, the current implementation fails to satisfy the requirement for robust cache removal. The logic on line 469 utilizes unquoted variables for globbing, which triggers word-splitting and will cause the script to fail for users with spaces in their file paths. While Codacy results are up to standards, this logic bug should be addressed before merging to ensure reliability across all environments.

1 comment outside of the diff
scripts/management/uninstall.sh

line 47 ⚪ LOW RISK
The variable MAGENTA is assigned but never used. Since other color variables such as CYAN and GREEN are already used for the script's output formatting, you should remove this unused definition to keep the script clean.

Test suggestions

  • Verify script syntax using 'bash -n' or 'shellcheck'\n- [ ] Execute cleanup_cache with a glob pattern that matches multiple files\n- [ ] Execute cleanup_cache with a glob pattern that matches zero files to ensure no error is thrown
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify script syntax using 'bash -n' or 'shellcheck'\n- [ ] Execute cleanup_cache with a glob pattern that matches multiple files\n- [ ] Execute cleanup_cache with a glob pattern that matches zero files to ensure no error is thrown

TIP Improve review quality by adding custom instructions
TIP How was this review? Give us feedback

if [[ "$cache_path" == *"*"* ]]; then
# Glob pattern
for item in $cache_path 2>/dev/null; do
for item in $cache_path; do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 MEDIUM RISK

Expanding $cache_path without quotes causes the shell to perform word splitting. If any directory in the path (such as the user's home directory) contains spaces, the loop will break the path into multiple invalid segments, causing the cleanup to fail. Refactor the cleanup_cache function to safely handle paths with spaces by avoiding unquoted variable expansion for globs (e.g., using shopt -s nullglob).

@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 64 issues detected

Severity Count
🔴 Critical 7
🟠 High 34
🟡 Medium 23

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in build.yml",
    "type": "missing_timeout_minutes",
    "file": "build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in push-email-notify.yml",
    "type": "missing_timeout_minutes",
    "file": "push-email-notify.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in instant-sync.yml",
    "type": "secret_action_without_presence_gate",
    "file": "instant-sync.yml",
    "action": "peter-evans/repository-dispatch",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "secret_action_without_presence_gate",
    "file": "mirror.yml",
    "action": "webfactory/ssh-agent",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "secret_action_without_presence_gate",
    "file": "mirror.yml",
    "action": "webfactory/ssh-agent",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "secret_action_without_presence_gate",
    "file": "mirror.yml",
    "action": "webfactory/ssh-agent",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "secret_action_without_presence_gate",
    "file": "mirror.yml",
    "action": "webfactory/ssh-agent",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "secret_action_without_presence_gate",
    "file": "mirror.yml",
    "action": "webfactory/ssh-agent",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in mirror.yml",
    "type": "secret_action_without_presence_gate",
    "file": "mirror.yml",
    "action": "webfactory/ssh-agent",
    "rule_module": "workflow_audit",
    "severity": "high"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "codeql_missing_actions_language",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant