8000
Skip to content

fix(shellcheck): add -r to shell version prelude reads - #1116

Merged
Tirito6626 merged 1 commit into
amber-lang:stagingfrom
VrtxOmega:fix-shellcheck-read-r-897
Jun 11, 2026
Merged

fix(shellcheck): add -r to shell version prelude reads#1116
Tirito6626 merged 1 commit into
amber-lang:stagingfrom
VrtxOmega:fix-shellcheck-read-r-897

Conversation

@VrtxOmega
@VrtxOmega VrtxOmega commented Jun 11, 2026
Copy link
Copy Markdown
Contributor

Addresses the SC2162 (read without -r) portion of #897.

Summary

  • Add -r to the generated shell-version prelude read calls for zsh and ksh.
  • Update the existing shell-version prelude translation test to expect the safer generated output.

Validation

  • docker run --rm -v /home/rage/.local/share/pcf/amber-897:/mnt koalam 8000 an/shellcheck:stable --exclude=SC2296,SC2034 /mnt/shellversion-before.sh (reproduces two SC2162 findings before the fix)
  • docker run --rm -v /home/rage/.local/share/pcf/amber-897:/mnt koalaman/shellcheck:stable --exclude=SC2296,SC2034 /mnt/shellversion-after.sh
  • cargo test test_translate_shellversion_preamble -- --nocapture
  • cargo test test_translate_shellname_and_shellversion_share_single_preamble -- --nocapture
  • cargo test --all-targets --all-features
  • cargo clippy --all-targets --all-features -- -D warnings
  • git diff --check

Note: this intentionally leaves the other ShellCheck classes from #897 for separate focused fixes.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Improved shell version parsing for ZSH and KSH shells to ensure correct handling of version string formatting.

@coderabbitai
coderabbitai Bot commented Jun 11, 2026
Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 827b0734-9710-4aa9-ba4f-d808addd0b90

📥 Commits

Reviewing files that changed from the base of the PR and between 2df94a0 and f102ea9.

📒 Files selected for processing (2)
  • src/preambles/shellname-shellversion.sh
  • src/tests/compiling.rs

📝 Walkthrough

Walkthrough

This PR updates shell version parsing to use the -r flag in read commands and sets IFS='.' for proper version string splitting in ZSH and KSH shells, with corresponding test snapshot expectations updated to verify the behavior.

Changes

Shell Version Parsing

Shell version parsing with -r flag and IFS handling
src/preambles/shellname-shellversion.sh, src/tests/compiling.rs
Layer / File(s) Summary
ZSH and KSH version parsing now uses read -r with IFS='.' to properly split version strings into the EXEC_SHELL_VERSION array, and test snapshot assertions are updated to expect the -r flag in both read invocations.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • Mte90
  • Ph0enixKM

Poem

🐰 A rabbit hops through shell commands so fine,
Adding flags to make version strings align,
With -r and IFS set just right,
The parsing works perfectly—what a delight!
Tests confirm the path is true,
Shell versions splitting as they should do! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(shellcheck): add -r to shell version prelude reads' directly and clearly describes the main change: adding the -r flag to read invocations in the shell version prelude, which aligns with the primary objective of addressing ShellCheck SC2162 findings.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

@Mte90
Mte90 requested review from Ph0enixKM and Tirito6626 June 11, 2026 15:52
@Tirito6626
Tirito6626 merged commit e9f1bad into amber-lang:staging Jun 11, 2026
1 check passed
@Mte90
Mte90 commented Jun 11, 2026
Copy link
Copy Markdown
Member

Thanks a lot :-)

@VrtxOmega
Copy link
Copy Markdown
Contributor Author

Thanks for the review and merge. Small process note: I used our Premature Contribution Firewall (PCF) workflow to keep this Amber contribution narrow, check for overlapping work first, and verify the generated output before opening the PR.

@VrtxOmega
VrtxOmega deleted the fix-shellcheck-read-r-897 branch June 11, 2026 16:05
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.

3 participants

0