Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple databases by excluding db/*schema.rb instead of db/schema.rb #646

Closed
xanderificnl opened this issue Mar 2, 2022 · 0 comments · Fixed by #647
Closed
Labels
enhancement New feature or request

Comments

@xanderificnl
Copy link

Expected behavior

For db/*schema.rb to be excluded.

Actual behavior

Only db/schema.rb is excluded.

Steps to reproduce the problem

Follow the instructions per the Rails guide to configure multiple databases: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application

And execute: rubocop -L | grep '^db/.*schema.rb'

example output:

❯ rubocop -L | grep '^db/.*schema.rb'
db/ring_schema.rb

RuboCop version

❯ rubocop -V
1.25.1 (using Parser 3.1.1.0, rubocop-ast 1.16.0, running on ruby 3.1.1 x86_64-linux)
  - rubocop-rails 2.13.2

A quick fix is changing db/schema.rb to db/*schema.rb in the YAML; but a recursive grep shows multiple files containing db/schema.rb in this repository, which may also require updating, but due to time constraints I can't dig deeper right now. I'll try to revisit this issue later, but if someone else wants to pick it up, feel free.

Cheers.

@koic koic added the enhancement New feature or request label Mar 2, 2022
koic added a commit to koic/rubocop-rails that referenced this issue Mar 2, 2022
…E]_schema.rb by default

Fixes rubocop#646.

This PR excludes db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default.

schema.rb will be the only file matched by `*schema.rb` directly under the db directory.
So I don't think there is any concern about false positives for plain Rails application.

See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application
koic added a commit to koic/rubocop-rails that referenced this issue Mar 2, 2022
…E]_schema.rb by default

Fixes rubocop#646.

This PR excludes db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default.

schema.rb will be the only file matched by `*schema.rb` directly under the db directory.
So I don't think there is any concern about false positives for plain Rails application.

See: https://guides.rubyonrails.org/active_record_multiple_databases.html#setting-up-your-application
@koic koic closed this as completed in #647 Mar 9, 2022
koic added a commit that referenced this issue Mar 9, 2022
…ration_namespace_schema_rb_by_default

[Fix #646] Exclude db/schema.rb and db/[CONFIGURATION_NAMESPACE]_schema.rb by default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants