Fix a false negative for FactoryBot/AssociationStyle when using keyword traits with explicit associations#168
Conversation
…word traits with explicit associations
|
I don't think these should be combined into a single pull request. While it's true that they modify nearby lines of the same cop, increasing the likelihood of conflicts, these three changes fundamentally address different issues and each involves a modification to the cop's behavior.
There's a possibility that users may be affected by each change, and they would likely check this in CHANGELOG.md. In that case, it would be preferable for them to be able to see only the small pull requests relevant to them. If any conflicts arise, I will resolve them as needed, and I don't mind doing that amount of work at all. (Even so, if the opinion from the maintainer's side is that merging such finely divided pull requests is too difficult, I will consolidate them, so please let me know.) |
A change related to keywords was introduced here:
FactoryBot/AssociationStylewhenassociationis called in trait block and column name is keyword #60At that time, the implementation was adjusted so that the following code would not be treated as an offense, but shouldn’t this actually be considered an offense?
In addition to changing the implementation, I made a few improvements:
KEYWORDSfrom an Array to a Set to improve performance.Before submitting the PR make sure the following are checked:
master(if not - rebase it).CHANGELOG.mdif the new code introduces user-observable changes.bundle exec rake) passes (be sure to run this locally, since it may produce updated documentation that you will need to commit).If you have created a new cop:
config/default.yml.Enabled: pendinginconfig/default.yml.VersionAdded: "<<next>>"indefault/config.yml.If you have modified an existing cop's configuration options:
VersionChanged: "<<next>>"inconfig/default.yml.