repo/toolchain-pinned/ruby
Toolchain version is pinned
Implements repo/toolchain-pinned for ruby.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | ruby |
| Scope | each |
| Kind | expr |
| Source | library v0.6.0 |
| Selected by | fleetlint-recommended@v0.6.0 |
Requirement
.ruby-version names a version, the Gemfile declares ruby "x.y.z", or .tool-versions/mise names ruby with a version.
Why
Without a pin, every machine and every CI run builds with whatever compiler or runtime happens to be installed, and failures cannot be reproduced.
Check
["", "../", "../../", "../../../"].exists(d, file(d + ".ruby-version") && scan(d + ".ruby-version", r'^\s*(ruby-)?\d').size() > 0) || scan("Gemfile", r'^\s*ruby\s+["\x27]\d').size() > 0 || ["", "../", "../../", "../../../"].exists(d, file(d + ".tool-versions") && scan(d + ".tool-versions", r'^\s*(ruby)\s+\S*\d').size() > 0) || ["", "../", "../../", "../../../"].exists(d, ["mise.toml", ".mise.toml", ".config/mise.toml", ".config/mise/config.toml", "mise/config.toml"].exists(n,
file(d + n) && scan(d + n, r'^\s*"?(ruby)"?\s*=\s*[^#\n]*\d').size() > 0))Fix
Write the Ruby version to .ruby-version.
Agent instruction: Add the stack’s toolchain pin set to the version currently installed; do not upgrade the toolchain in the same change.
A finding of this rule points at .ruby-version.
Sources
- https://fleetlint.org/baseline/#hygiene (convention)
- https://mise.jdx.dev/configuration.html (spec)
- https://fleetlint.org/stacks/
- https://guides.rubygems.org/gemfile_ruby/ (spec)
- https://fleetlint.org/stacks/#ruby
Generated by fleetlint docs from catalog v0.6.0.