Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #7165. This PR fixes an auto-correct error for `Style/ConditionalAssignment` when without `else` branch'. This error occurs when `EnforcedStyle: assign_inside_condition`. ```yaml # .rubocop.yml Style/ConditionalAssignment: EnforcedStyle: assign_inside_condition ``` ```ruby # example.rb var = if foo bar elsif baz qux end ``` ```console % rubocop -a --only Style/ConditionalAssignment Inspecting 1 file 0 files inspected, no offenses detected undefined method `column' for nil:NilClass /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/rubocop/cop/style/conditional_assignment.rb:600:in `move_branch_' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/rubocop/cop/style/conditional_assignment.rb:576:in `block (2 lev' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/rubocop/cop/style/conditional_assignment.rb:575:in `each' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/rubocop/cop/style/conditional_assignment.rb:575:in `block in mov' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/rubocop/cop/corrector.rb:64:in `block (2 levels) in rewrite' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/parser-2.6.3.0/lib/parser/source/tree_rewriter.rb:220:in `transaction' /Users/koic/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rubocop-0.71.0/lib/rubocop/cop/corrector.rb:63:in `block in rewrite' ```
- Loading branch information