Feature Request
Add bashrs lint validation to CI and the zsh-widget command to catch shell scripting bugs before they reach users.
Current Problem
The ZSH widget code has multiple lint issues that could have been caught automatically:
$ aprender-shell zsh-widget | bashrs lint /dev/stdin
Summary: 0 error(s), 2 warning(s), 6 info(s)
Score: B (7.5/10)
Issues found:
- SC2046: Unquoted command substitution (word splitting risk)
- SC2016: Single quotes preventing expansion
- SC2148: Missing shebang
- SC2201: Brace expansion in assignments
- SC2227: Redirection before pipe
Proposed Solution
1. CI Integration
Add to GitHub Actions workflow:
- name: Validate generated shell code
run: |
cargo run --bin aprender-shell -- zsh-widget > /tmp/widget.sh
bashrs lint /tmp/widget.sh --strict
bashrs audit /tmp/widget.sh
2. Build-time validation
In build.rs or as a test:
#[test]
fn test_zsh_widget_passes_lint() {
let widget = generate_zsh_widget();
let output = Command::new("bashrs")
.args(["lint", "--format", "json", "/dev/stdin"])
.stdin(widget.as_bytes())
.output()
.expect("bashrs not installed");
let result: LintResult = serde_json::from_slice(&output.stdout)?;
assert!(result.errors.is_empty(), "Widget has lint errors: {:?}", result.errors);
assert!(result.warnings.len() < 3, "Too many warnings: {:?}", result.warnings);
}
3. Runtime warning
When generating widget code:
$ aprender-shell zsh-widget
# aprender-shell ZSH widget
# Validated with bashrs: 0 errors, 0 warnings
...
4. Quality gate
Block releases if widget score drops below threshold:
const MIN_WIDGET_SCORE: f32 = 8.0; // Require B+ or better
Benefits
- Catch bugs early - Before users install broken widgets
- Consistent quality - Automated enforcement
- Documentation - Score shows widget quality
- Cross-shell validation - bashrs knows POSIX, bash, zsh quirks
bashrs Checks That Apply
| Check |
Description |
Severity |
| SC2046 |
Unquoted command substitution |
Warning |
| SC2086 |
Unquoted variable |
Warning |
| SC2148 |
Missing shebang |
Info |
| SC2154 |
Unassigned variable |
Warning |
| IDEM* |
Idempotency issues |
Warning |
| SAFE* |
Safety issues |
Error |
Related
Feature Request
Add
bashrs lintvalidation to CI and thezsh-widgetcommand to catch shell scripting bugs before they reach users.Current Problem
The ZSH widget code has multiple lint issues that could have been caught automatically:
$ aprender-shell zsh-widget | bashrs lint /dev/stdin Summary: 0 error(s), 2 warning(s), 6 info(s) Score: B (7.5/10)Issues found:
Proposed Solution
1. CI Integration
Add to GitHub Actions workflow:
2. Build-time validation
In
build.rsor as a test:3. Runtime warning
When generating widget code:
4. Quality gate
Block releases if widget score drops below threshold:
Benefits
bashrs Checks That Apply
Related