r7kamura / sevencop

Opinionated custom cops for RuboCop.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BelongsToOptional doesn't work well with scope argument

r7kamura opened this issue · comments

Failures:

  1) RuboCop::Cop::Sevencop::BelongsToOptional with scope autocorrects offense
     Failure/Error:
       expect_offense(<<~TEXT)
         belongs_to :group, -> { a }
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Specify :optional option.
       TEXT
     
       Diff:
       @@ -1,3 +1,2 @@
        belongs_to :group, -> { a }
       -^^^^^^^^^^^^^^^^^^^^^^^^^^^ Specify :optional option.
       
     # ./spec/rubocop/cop/sevencop/belongs_to_optional_spec.rb:64:in `block (3 levels) in <top (required)>'