Skip to content

[Fix #461] Add new LoadDefaultsMismatch cop #1611

Open
nzlaura wants to merge 1 commit into
rubocop:masterfrom
nzlaura:feat/load-defaults-version-check
Open

[Fix #461] Add new LoadDefaultsMismatch cop #1611
nzlaura wants to merge 1 commit into
rubocop:masterfrom
nzlaura:feat/load-defaults-version-check

Conversation

@nzlaura
Copy link
Copy Markdown

@nzlaura nzlaura commented May 2, 2026

Fixes #461

Introduces a new cop that checks that the version of rails in the config.load_defaults matches the version of Rails being used by a project. I have not allowed an autocorrect as it's not a safe change for the cop to make for you- instead this cop raises a warning that the version does not match.

I've followed the ruby style guide in implementing this, to check that the version in the config.load_defaults matches the exact version being used in the project.

https://rails.rubystyle.guide/#config-defaults


Before submitting the PR make sure the following are checked:

  • The PR relates to only one subject with a clear title and description in grammatically correct, complete sentences.
  • Wrote good commit messages.
  • Commit message starts with [Fix #issue-number] (if the related issue exists).
  • Feature branch is up-to-date with master (if not - rebase it).
  • Squashed related commits together.
  • Added tests.
  • Ran bundle exec rake default. It executes all tests and runs RuboCop on its own code.
  • Added an entry (file) to the changelog folder named {change_type}_{change_description}.md if the new code introduces user-observable changes. See changelog entry format for details.
  • If this is a new cop, consider making a corresponding update to the Rails Style Guide.

… that are out of date in `config.load_defaults`
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.

Cop idea: Detect outdated load_defaults for Rails updates

1 participant