Skip to content

Technical Debt: Fix SC2086 and SC2155 ShellCheck warnings #50

@senomorf

Description

@senomorf

📋 Issue Description

Address the SC2086 (quote variables) and SC2155 (separate declare/assign) ShellCheck warnings that are currently suppressed globally in .shellcheckrc.

🎯 Background

From PR #43 linting infrastructure review, Claude identified this as low-priority technical debt. These warnings are currently commented out in .shellcheckrc with notes to "fix these individually".

📊 Current State

  • SC2086 instances: ~51 across scripts and tests
  • SC2155 instances: ~51 across scripts and tests
  • Total affected files: ~28 shell scripts

🔧 Tasks

Phase 1: Enable Warnings

  • Remove # disable=SC2086 and # disable=SC2155 comments from .shellcheckrc
  • Run ShellCheck to get full list of violations

Phase 2: Fix Issues Systematically

  • SC2086: Add double quotes around variables to prevent globbing/word splitting
    • Example: $var"$var"
    • Exception: Cases where word splitting is intentional (add inline # shellcheck disable=SC2086)
  • SC2155: Separate declare and assign statements to avoid masking return values
    • Example: local var=$(command)local var; var=$(command)

Phase 3: Validate

  • Run full test suite to ensure no regressions
  • Verify all ShellCheck warnings are addressed or properly suppressed

📈 Benefits

  • Improved error handling: SC2155 fixes ensure command failures aren't masked
  • Better variable safety: SC2086 fixes prevent accidental globbing/word splitting
  • Cleaner linting: Reduces global suppressions in favor of targeted fixes

🕒 Estimated Effort

  • 2-3 hours spread across multiple sessions
  • Risk: Low (quality improvements, not functional changes)

📝 Acceptance Criteria

  • SC2086 and SC2155 warnings enabled in .shellcheckrc
  • All legitimate violations fixed with proper quoting/declaration patterns
  • Intentional cases have inline suppressions with comments
  • All tests pass after changes
  • ShellCheck reports zero SC2086/SC2155 violations

🏷️ Labels

  • technical-debt
  • code-quality
  • shellcheck
  • low-priority

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions