-
-
Notifications
You must be signed in to change notification settings - Fork 14
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
Bug Report: --only option ignores FactoryBot/AttributeDefinedStatically #44
Comments
Thank you for report. Could you describe the code to reproduce? |
First case. I have the factory: # frozen_string_literal: true
FactoryBot.define do
factory :mask do
association :blocklist, strategy: :build
end
end I run rubocop:
I run rubocop with
I run rubocop with
|
Second case. I have the factory: FactoryBot.define do
factory :mask do
association :blocklist, strategy: :build
end
end I run rubocop:
It doesn't show me the FactoryBot/AttributeDefinedStatically cop. |
This is quite interesting.
This shouldn't happen, as |
I can't reproduce locally. @ydakuka can you please set a breakpoint in |
I reproduced it:
|
It certainly does not seem to offense the current implementation of
rubocop-factory_bot/lib/rubocop/cop/factory_bot/attribute_defined_statically.rb Lines 80 to 82 in 81d95db
Therefore, it is not an offense:
|
If we run RuboCop without adding the Original code: # frozen_string_literal: true
FactoryBot.define do
factory :mask do
association :blocklist, strategy: :build
end
end Run # frozen_string_literal: true
FactoryBot.define do
factory :mask do
blocklist strategy: :build
end
end Run # frozen_string_literal: true
FactoryBot.define do
factory :mask do
blocklist { { strategy: :build } }
end
end |
Good question! @rubocop/rubocop-core |
Can you please create a reproduction repo, @ydah ? |
A repository has been created to reproduce: But I noticed an interesting behavior. First:
Running with automatic correction:
Run again with revert auto correct:
Perhaps this behavior is referring to the cache? |
Actual behavior
RuboCop version
FactoryBot version
The text was updated successfully, but these errors were encountered: