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

Restrict DuplicateAssociation cop to ActiveRecord #994

Merged

Conversation

mjankowski
Copy link
Contributor

Previously this cop would run against all classes, which led to false positives when the class was not descended from ActiveRecord::Base and thus might have acceptable use cases for repeating association declarations in ways that would not be acceptable in AR classes.

@mjankowski mjankowski force-pushed the duplicate-associations-only-on-activerecord branch from fa6b9d7 to 06bc1a4 Compare May 1, 2023 20:58
@@ -227,4 +227,15 @@ class Post < ApplicationRecord
RUBY
end
end

describe 'a class that does not descend from activerecord' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's just my two cents:

Suggested change
describe 'a class that does not descend from activerecord' do
describe 'a class that does not descend from Active Record' do

@koic
Copy link
Member

koic commented Jul 19, 2023

Can you add a changelog entry?

@mjankowski mjankowski force-pushed the duplicate-associations-only-on-activerecord branch from 06bc1a4 to e8a542a Compare July 19, 2023 10:33
@mjankowski
Copy link
Contributor Author

Sure thing.

Rebased against master, accepted the suggested changed, added changelog entry.

@koic
Copy link
Member

koic commented Jul 19, 2023

Thanks! Can you squash your commits into one?

Previously this cop would run against all classes, which led to false
positives when the class was not descended from `ActiveRecord::Base`
and thus might have acceptable use cases for repeating association
declarations in ways that would not be acceptable in AR classes.
@mjankowski mjankowski force-pushed the duplicate-associations-only-on-activerecord branch from e8a542a to bc81740 Compare July 19, 2023 11:18
@mjankowski
Copy link
Contributor Author

Squashed.

@koic koic merged commit d81af27 into rubocop:master Jul 19, 2023
10 checks passed
@koic
Copy link
Member

koic commented Jul 19, 2023

👍

@mjankowski mjankowski deleted the duplicate-associations-only-on-activerecord branch July 27, 2023 14:03
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.

None yet

2 participants