Module: Shirobai::Rails
- Defined in:
- lib/shirobai-rails.rb,
lib/shirobai/rails/version.rb
Overview
Glue for the shirobai-rails plugin gem: the packed-config segment (just a wake-up flag — the Application* cluster carries no behavioral config).
Unlike shirobai-rspec there is NO per-file gate: rubocop-rails cops run on
every Ruby file (no department Include like RSpec's **/*_spec.rb), so
once this gem is loaded the rails origin is always awake. The core packs
this origin's segment into every config from now on.
Constant Summary collapse
- COP_CLASSES =
Wrapper cop classes, appended as cops land. Kept for parity with the sibling plugins and for plumbing specs.
[ Shirobai::Cop::Rails::ApplicationRecord, Shirobai::Cop::Rails::ApplicationController, Shirobai::Cop::Rails::ApplicationMailer, Shirobai::Cop::Rails::ApplicationJob, Shirobai::Cop::Rails::UnknownEnv, Shirobai::Cop::Rails::DynamicFindBy, Shirobai::Cop::Rails::Pluck, Shirobai::Cop::Rails::HttpPositionalArguments, Shirobai::Cop::Rails::DeprecatedActiveModelErrorsMethods ].freeze
- VERSION =
Locked to the shirobai core gem version (release train: both gems ship together and the gemspec pins
shirobaito this exact version). "2026.0709.0000"
Class Method Summary collapse
-
.segment(config) ⇒ Object
The rails origin's
[nums, lists]segment forconfig.
Class Method Details
.segment(config) ⇒ Object
The rails origin's [nums, lists] segment for config. The wake-up
flag is always 1 once the gem is loaded; the rest is each config-
bearing cop's own bundle_args (the single source of its config).
Segment layout (crates/shirobai-core/src/rules/rails_config.rs):
nums = [enabled, unknown_env_supports_local]
lists = [unknown_env_environments,
dynamic_find_by_allowed_methods,
dynamic_find_by_allowed_receivers,
dynamic_find_by_whitelist]
Per-cop gating that DOES vary (the Rails/ApplicationRecord
Exclude: db/**/*.rb, the TargetRailsVersion gates, and each cop's
Enabled) is NOT in this segment: RuboCop resolves it through each
wrapper's own cop config exactly as for the stock cop, so a file a
wrapper does not run on simply drops that cop's Rust-computed slot
while the other cops' slots (from the same shared walk) are consumed.
79 80 81 82 83 84 85 |
# File 'lib/shirobai-rails.rb', line 79 def segment(config) ue = Shirobai::Cop::Rails::UnknownEnv.bundle_args(config) dfb = Shirobai::Cop::Rails::DynamicFindBy.bundle_args(config) nums = [1, *ue[0]] lists = [*ue[1], *dfb[1]] [nums, lists] end |