Skip to content

Rails cops differ in output when config file is moved to non-standard location #1521

@Splines

Description

@Splines

Related to MaMpf-HD/mampf#768.

We don't use the default location of the RuboCop config file: .rubocop.yml. Instead, we configure it as .config/.rubocop.yml and specify the config CLI option via --config .config/.rubocop.yml. However, in this custom location, some offenses are not reported.

🎈 Expected behavior

We expect RuboCop Rails to give us exactly the same output for these two commands (given that the config file is moved to the correct location respectively):

bundle exec rubocop --config .rubocop.yml 
bundle exec rubocop --config ./.config/.rubocop.yml
# expect outputs to be the same

We don't use any general "exclude" patterns that would depend on the relative file location of the config file.
(only one "exclude" file pattern for a specific rule that is not relevant here)

🎈 Actual behavior

When we run the following command, we get no offenses at all.

bundle exec rubocop --config ./.config/.rubocop.yml
# 780 files inspected, no offenses detected

When we run the following command, we get offenses:

bundle exec rubocop --config .rubocop.yml 
# 780 files inspected, 94 offenses detected

These offenses include (among others):

  • Rails/ThreeStateBooleanColumn
  • Rails/I18nLocaleAssignment
  • Rails/DangerousColumnNames
  • Rails/NotNullColumn

RuboCop version

$ bundle exec rubocop -V
1.78.0 (using Parser 3.3.8.0, Prism 1.4.0, rubocop-ast 1.46.0, analyzing as Ruby 3.3, running on ruby 3.3.8) [x86_64-linux]
  - rubocop-performance 1.25.0
  - rubocop-rails 2.32.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions