chore: update Standardrb, configure Rubocop to use Standard rules#51
chore: update Standardrb, configure Rubocop to use Standard rules#51Envek wants to merge 4 commits intorubyatscale:mainfrom
Conversation
dduugg
left a comment
There was a problem hiding this comment.
PR Review: "chore: update Standardrb, configure Rubocop to use Standard rules"
Goal
Two things: (1) configure RuboCop to inherit Standard's rules so that editor RuboCop integrations stop fighting with Standard, and (2) update Standard and related gems to their latest versions. The GitHub Actions workflow is also modernized along the way.
What's Already on main
PR #59 (just merged) already added permissions: checks: write / contents: read to standardrb.yaml, so there will be a minor merge conflict there. Everything else in this PR is new.
Implementation
.rubocop.yml: Addsrequireandinherit_gemdirectives so RuboCop loads Standard's rule set directly. This makes editor RuboCop plugins agree withstandardrbon style..standard.yml: Removesextend_config: - .rubocop.yml— that directive was pointing Standard at RuboCop config, but the relationship is now inverted (RuboCop inherits from Standard). Keeping it would cause a circular reference..github/workflows/standardrb.yaml:- Renames job
build→standardrb(clearer name). - Removes the separate
actions/checkout@v1step —standard-ruby-action@v1handles checkout itself. - Upgrades action from
v0.0.5→v1. - Adds
permissions: checks: write / contents: write.
- Renames job
Gemfile.lock: Bumps standard1.35.1→1.54.0, rubocop1.62.1→1.84.2, and transitive deps.lib/singed.rb/lib/singed/cli.rb: Removes two unusedrequire "pathname"lines (likely surfaced by the updated linter).
Risk Assessment
Low risk overall. This is tooling/config only — no production code changes beyond removing two unused require lines.
1. contents: write is broader than necessary
PR #59 landed with contents: read. This PR uses contents: write. The StandardRB action only needs to read code and post check results — contents: write grants it push access to the repo, which is more than required. Recommend keeping contents: read from #59.
2. Minor merge conflict with PR #59
The standardrb.yaml diff will conflict with what #59 already merged (permissions block, job still named build). The resolution is straightforward: keep contents: read from #59 and apply the remaining changes (rename job, upgrade action version, remove checkout step) from this PR.
3. TargetRubyVersion: 2.7 in .rubocop.yml may be outdated
The existing .rubocop.yml targets Ruby 2.7. The CI matrix (from build.yml) tests against 3.2, 3.3, 3.4, and 4. Worth bumping TargetRubyVersion to at least 3.2 to get accurate cop behavior — though this is a pre-existing issue, not introduced by this PR.
Summary
Good housekeeping PR. The .rubocop.yml + .standard.yml change is the main substance and is correct. Main items before merging:
- Resolve the minor merge conflict with #59 in
standardrb.yaml; keepcontents: readrather thancontents: write - Optionally bump
TargetRubyVersionto match the minimum supported Ruby (pre-existing issue, but good to fix while touching the file)
That allow standardrb action to automatically fix pushed code in a follow-up commit. See If it is not desired we can rollback this change.
Resolved
It was in sync with gemspec before #55, updated to 3.2 accordingly |
As Standardrb is based on Rubocop and default Rubocop configuration is dramatically different from Standardrb opinions, my editor detected
.rubocop.ymland became mad and tried to autocorrect everything to Rubocop default style.So I decided to make Rubocop to obey Standardrb rules so they are in sync (see Running Standard's rules via RuboCop)
Updated gems and github actions along the way