Skip to content

Make the rubocop CI job blocking again, automate rubocop-todo - #1260

Open
apiology wants to merge 3 commits into
castwide:masterfrom
apiology:worktree-rubocop-todo-blocking
Open

Make the rubocop CI job blocking again, automate rubocop-todo#1260
apiology wants to merge 3 commits into
castwide:masterfrom
apiology:worktree-rubocop-todo-blocking

Conversation

@apiology

@apiology apiology commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bump dev-dependency RuboCop from 1.80.0 to 1.89.0. 1.80.0 had a bug where per-file AllCops:Exclude entries didn't remove files from the scan target list, so spec/fixtures/invalid_{byte,utf8,node_comment}.rb (fixtures with intentionally invalid encoding, used by spec/source_spec.rb and spec/source_map/mapper_spec.rb to test Solargraph's own error handling) always failed Lint/Syntax regardless of Exclude config — confirmed this doesn't reproduce on 1.89.0, and no config-based fix exists (RuboCop refuses any config for Lint/Syntax at all).
  • Consolidate the three fixture exclude entries in .rubocop.yml into one glob.
  • Fix the todo-sync step in .github/workflows/linting.yml: rubocop --auto-gen-config's exit code reflects the total offense count, not just newly-introduced offenses, so under GitHub Actions' default bash -e it aborted before ever reaching the git-diff check that's meant to be the actual pass/fail signal.
  • Remove continue-on-error: true from both rubocop_todo job steps (marked @todo Temporary, expect to revert in 0.60 — already at 0.60.2) and regenerate .rubocop_todo.yml against 1.89.0.
  • On push to master only: if RuboCop is clean, auto-regenerate .rubocop_todo.yml and push the result if it shrank (i.e. someone fixed a todo'd offense without removing its entry), so that cleanup no longer has to be done by hand. This can't extend to PRs — GITHUB_TOKEN can't push to a fork's branch, and most PRs on this repo come from forks — so PRs keep the existing fail-with-diff behavior asking the contributor to regenerate and push it themselves.

Test plan

  • bundle exec rubocop -c .rubocop.yml — 386 files inspected, no offenses detected
  • Simulated the todo-sync step's git-diff logic locally — clean, no diff
  • bundle exec rspec — 1623 examples, 0 failures (60 pre-existing pending)
  • CI green on this PR (.rubocop_todo.yml, rubocop, overcommit all pass)
  • Auto-update step verified on an actual push to master (can't be exercised from a PR)

🤖 Generated with Claude Code

https://claude.ai/code/session_018s7rWmpEoZpj4o3To7F286

- Bump dev-dependency RuboCop from 1.80.0 to 1.89.0: 1.80.0 had a bug
  where per-file AllCops:Exclude entries didn't remove files from the
  scan target list, so spec/fixtures/invalid_{byte,utf8,node_comment}.rb
  (fixtures with intentionally invalid encoding, used to test
  Solargraph's own error handling) always failed Lint/Syntax regardless
  of Exclude config. 1.89.0 fixes this.
- Consolidate the three fixture exclude entries into one glob.
- Fix the todo-sync step: rubocop --auto-gen-config's exit code
  reflects the total offense count, not just new offenses, so under
  GitHub Actions' default bash -e it aborted before reaching the
  git-diff check that's meant to be the actual pass/fail signal.
- Remove continue-on-error from both rubocop_todo steps and
  regenerate .rubocop_todo.yml against 1.89.0.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018s7rWmpEoZpj4o3To7F286
@apiology apiology changed the title Make the rubocop_todo CI job blocking Make the rubocop, rubocop_todo CI jobs blocking again Aug 4, 2026
The previously committed version was missing --no-offense-counts
(78 stray "# Offense count: N" comment lines), causing the
todo-sync check to fail: CI's fresh `bundle install` regeneration
diverged from the committed file even with identical gem versions
installed.
When rubocop is clean (the "Run RuboCop" step already passed), any diff
from regenerating .rubocop_todo.yml can only be a shrink -- offenses
that got fixed without removing their todo entry -- never a new
offense. On push to master, commit and push that cleanup automatically
instead of asking someone to do it by hand.

This can't apply to PRs: GITHUB_TOKEN can't push to a fork's branch,
and most PRs on this repo come from forks. PRs keep the existing
fail-with-diff behavior.
@apiology apiology changed the title Make the rubocop, rubocop_todo CI jobs blocking again Make the rubocop CI job blocking again, automate rubocop-todo Aug 4, 2026
@apiology
apiology marked this pull request as ready for review August 17, 2026 21:28
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.

1 participant