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

Many new false positives for Rails/HasManyOrHasOneDependent #5293

Closed
reidab opened this issue Dec 21, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@reidab
Copy link

commented Dec 21, 2017

On the current master (78d70ca), I'm seeing a ton of false positives for the Rails/HasManyOrHasOneDependent cop. I'm guessing this is related to the changes in #5235.


Expected behavior

This clearly specifies the dependent option

class List < ApplicationRecord
  has_many :items, dependent: :destroy
end

Actual behavior

Inspecting 1 file
C

Offenses:

app/models/list.rb:4:3: C: Rails/HasManyOrHasOneDependent: Specify a :dependent option.
  has_many :items, dependent: :destroy
  ^^^^^^^^

1 file inspected, 1 offense detected

Steps to reproduce the problem

  1. run rubocop against the file above with the Rails/HasManyOrHasOneDependent cop enabled.

RuboCop version

Installed from github master (78d70ca):

0.52.0 (using Parser 2.4.0.2, running on ruby 2.4.2 x86_64-darwin16)
@koic

This comment has been minimized.

Copy link
Member

commented Dec 21, 2017

Sure. I confirmed reproduction and this issue is a regression by #5235. I'm going to open a PR to resolve this issue. Thanks for telling us issue using master branch.

koic added a commit to koic/rubocop that referenced this issue Dec 21, 2017

[Fix rubocop-hq#5293] Fix regression for `Rails/HasManyOrHasOneDepend…
…ent` cop

Fixes rubocop-hq#5293.
This commit changed the existing test codes and fixed the regression by rubocop-hq#5235.

koic added a commit to koic/rubocop that referenced this issue Dec 21, 2017

[Fix rubocop-hq#5293] Fix regression for `Rails/HasManyOrHasOneDepend…
…ent` cop

Fixes rubocop-hq#5293.
This commit changed the existing test codes and fixed the regression by rubocop-hq#5235.

bbatsov added a commit that referenced this issue Dec 22, 2017

[Fix #5293] Fix regression for `Rails/HasManyOrHasOneDependent` cop (#…
…5295)

Fixes #5293.
This commit changed the existing test codes and fixed the regression by #5235.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.