This issue was written with Claude Code's assistance.
Problem
When using rubocop 1.84.2 / rubocop-rails 2.34.3, running RuboCop produces:
Warning: AllCops does not support TargetRailsVersion parameter.
Cause
rubocop-rails handles this in its own plugin.rb by monkey-patching ConfigValidator::COMMON_PARAMS to include TargetRailsVersion:
# FIXME: This is a dirty hack relying on a private constant to prevent
# "Warning: AllCops does not support TargetRailsVersion parameter".
ConfigValidator.const_set(:COMMON_PARAMS, ConfigValidator::COMMON_PARAMS.dup << 'TargetRailsVersion')
But standard-rails bypasses rubocop-rails' normal plugin loading (via load_rubocop_rails_without_the_monkey_patch.rb), so that hack never runs.
PR #97 (released in v1.6.0) addressed this for MigratedSchemaVersion (unconditional delete) but only removes TargetRailsVersion when its value is nil:
all_cops.delete("MigratedSchemaVersion")
all_cops.delete("TargetRailsVersion") if all_cops.key?("TargetRailsVersion") && all_cops["TargetRailsVersion"].nil?
Since rubocop-rails' default.yml sets TargetRailsVersion: ~ (YAML nil), the conditional delete does match — but only before a user sets a target_rails_version in .standard.yml. In practice, the warning still appears (possibly due to config merging order or rubocop version differences).
Gem versions
rubocop (1.84.2)
rubocop-rails (2.34.3)
standard (1.54.0)
standard-rails (1.6.0)
Suggested fix
Unconditionally remove TargetRailsVersion from AllCops, matching the existing MigratedSchemaVersion handling:
all_cops.delete("MigratedSchemaVersion")
all_cops.delete("TargetRailsVersion")
Problem
When using
rubocop 1.84.2/rubocop-rails 2.34.3, running RuboCop produces:Cause
rubocop-rails handles this in its own
plugin.rbby monkey-patchingConfigValidator::COMMON_PARAMSto includeTargetRailsVersion:But standard-rails bypasses rubocop-rails' normal plugin loading (via
load_rubocop_rails_without_the_monkey_patch.rb), so that hack never runs.PR #97 (released in v1.6.0) addressed this for
MigratedSchemaVersion(unconditional delete) but only removesTargetRailsVersionwhen its value isnil:Since rubocop-rails'
default.ymlsetsTargetRailsVersion: ~(YAML nil), the conditional delete does match — but only before a user sets atarget_rails_versionin.standard.yml. In practice, the warning still appears (possibly due to config merging order or rubocop version differences).Gem versions
Suggested fix
Unconditionally remove
TargetRailsVersionfromAllCops, matching the existingMigratedSchemaVersionhandling: