Skip to content

style: adopt the shared Elanthia Online RuboCop rules - #274

Merged
MahtraDR merged 1 commit into
elanthia-online:mainfrom
MahtraDR:style/shared-rubocop-rules
Oct 26, 2026
Merged

MahtraDR merged 1 commit into
elanthia-online:mainfrom
MahtraDR:style/shared-rubocop-rules

Conversation

@MahtraDR

Copy link
Copy Markdown
Contributor

This moves ProfanityFE onto the RuboCop configuration the EO admins agreed to share across lich-5, scripts, dr-scripts and ProfanityFE.

What changes

  • .rubocop/base.yml and .rubocop/cops/ascii_only_source.rb are byte-identical copies of the shared config and its custom cop. .rubocop.yml only inherits from the base. It may list excluded files, but it lists none.
  • RuboCop is pinned to 1.92.1. Gemfile.lock was updated only for rubocop and its dependencies.
  • ProfanityFE no longer turns off the ASCII cops or Lint/ScriptPermission. That brought 217 offenses, and this PR fixes all of them, with no excludes and no rubocop:disable comments.

How the offenses were fixed

  • Comments: plain-ASCII equivalents. Arrows become ->, the section sign becomes "section", and an example character is written as U+00E9.
  • Non-ASCII strings, mostly Unicode test data in the specs: the custom cop also flags \u escapes and \x escapes above 0x7F, so "café" isn't allowed either. These characters are now built at runtime, as in "caf#{[0x00E9].pack('U')}", which is how lich-5's specs already do it. Every rewritten literal was checked to have the same bytes and encoding as before, so the tests still exercise exactly the same input.
  • SharedState::TITLE_UNSAFE: now /[\p{Cc}\\]/u. It matches exactly the same code points as the old [\x00-\x1f\x7f\u0080-\u009f\\] (checked over every code point) and has the same encoding and options.
  • Constants in effects_window.rb and line_buffered.rb: the ellipsis, rule and scrollbar characters are built with pack('U').freeze. They have the same value and are still frozen.
  • script/check_yard_tags.rb: has a shebang, so git now records it as executable.

Safe autocorrect would have replaced characters inside four spec strings (for example '^Bob says — hi' would have become '^Bob says - hi'). Those strings were restored and rewritten by hand, so their test data is unchanged.

Verification

  • bundle exec rubocop: 0 offenses.
  • bundle exec rspec: 4282 examples, 0 failures, in defined order and with three random seeds.
  • YARD with --fail-on-warning and script/check_yard_tags.rb (including --self-test): clean.
  • No changes to .github/workflows/ or .ruby-version. Other PRs handle those.

🤖 Generated with Claude Code

Replace .rubocop.yml with an inherit_from of .rubocop/base.yml, a
byte-identical copy of the shared EO config (with the custom
AsciiOnlySource cop), and pin RuboCop to 1.92.1. ProfanityFE no longer
turns off the ASCII cops or Lint/ScriptPermission.

Fix all 217 offenses without changing behavior:
- Comments: plain-ASCII equivalents (-> for arrows, "section" for the
  section sign, U+XXXX for example characters).
- Non-ASCII string values: AsciiOnlySource also flags \u and high \x
  escapes, so non-ASCII characters are built at runtime with
  [0x00E9].pack('U'), as lich-5's specs already do. Every rewritten
  literal was checked to have the same bytes and encoding as before.
- SharedState::TITLE_UNSAFE: [\p{Cc}\\] with /u matches exactly the
  same code points as the old \x00-\x1f\x7f\u0080-\u009f class.
- script/check_yard_tags.rb is now executable (it has a shebang).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c5b80250-0118-412c-b8e4-8e02edc87427

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@MahtraDR
MahtraDR merged commit 2ac621c into elanthia-online:main Oct 26, 2026
5 checks passed
@MahtraDR
MahtraDR deleted the style/shared-rubocop-rules branch October 26, 2026 23:19
MahtraDR added a commit that referenced this pull request Oct 26, 2026
This moves ProfanityFE onto the shared CI baseline the EO admins agreed
on, following #274, which adopted the shared RuboCop rules.

Lint and tests now come from one shared workflow in
elanthia-online/.github, pinned by commit SHA. The YARD checks stay here
as a repo-specific job with their steps unchanged. A new ci-gate job
sums up every job and will be the single required check once branch
protection is switched on. It replaces rspec_tests,
rubocop_syntax_checker, ruby_syntax_checker and yard_docs. The YARD job
now runs on every PR instead of only when Ruby files change, so the
required check always reports. .ruby-version is bumped to 4.0.9 and is
the only place the CI Ruby version is set.

Checked locally: RuboCop reports no offenses across 246 files, the suite
passes on two seeds (4282 examples, 0 failures), and all four YARD
checks pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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