lint/strict/ruby
RuboCop enables new cops
Implements lint/strict for ruby.
| Severity | warning |
| Tiers | 1, 2 |
| Stacks | ruby |
| Scope | each |
| Kind | expr |
| Source | library v0.4.0 |
| Selected by | fleetlint-recommended@v0.4.0 |
Requirement
The nearest .rubocop.yml, or a file it inherits from, sets AllCops: NewCops: enable (or the configuration inherits Standard), so cops added by RuboCop upgrades run instead of waiting as pending.
Why
RuboCop adds most new checks as pending; without NewCops enable a project keeps the rule set of the version it started with.
Applies when
["", "../", "../../", "../../../"].exists(d, file(d + ".rubocop.yml"))Check
[["", "../", "../../", "../../../"].filter(d, file(d + ".rubocop.yml"))] .exists(l, [l[0]].exists(d, [yaml(d + ".rubocop.yml")].exists(y, y != null && (
(has(y.AllCops) && y.AllCops != null && "NewCops" in y.AllCops && y.AllCops.NewCops == "enable")
|| (has(y.inherit_gem) && y.inherit_gem != null && "standard" in y.inherit_gem)
|| (has(y.inherit_from) && (type(y.inherit_from) == list ? y.inherit_from : dyn([y.inherit_from]))
.exists(p, file(d + p) && [yaml(d + p)].exists(z, z != null && has(z.AllCops) && z.AllCops != null
&& "NewCops" in z.AllCops && z.AllCops.NewCops == "enable")))))))Fix
Set NewCops: enable under AllCops in .rubocop.yml.
Agent instruction: Set NewCops: enable under AllCops in .rubocop.yml and fix or ratchet (.rubocop_todo.yml) what the new cops report.
Sources
- https://fleetlint.org/baseline/#static-analysis (convention)
- https://docs.rubocop.org/rubocop/latest/versioning.html (spec)
- https://fleetlint.org/stacks/#ruby
Generated by fleetlint docs from catalog v0.4.0.