Skip to content

False positive registering of offense by Lint/RequireRangeParentheses when Date range has line break (non endless range) #14362

@marcofognog

Description

@marcofognog

After rubocop -A, one line was "linebroken" by Rubocop and failed with Lint/RequireRangeParentheses

Expected behavior

Rubocop should not register offense when there is no endless range in the node.

Actual behavior

It registers Lint/RequireRangeParentheses when Date ranges have linebreaks, even thou there is no endless range.

Steps to reproduce the problem

To reproduce it, add the following spec to spec/rubocop/cop/lint/require_range_parentheses_spec.rb :

  it 'does not register an offense when there is a line break in a date range' do
    expect_no_offenses(<<~RUBY)
      Date.new(1989, 0o1, 
        0o1)..Date.new(1989, 12, 31)
    RUBY
  end

The spec above should pass.

RuboCop version

The above code fails against master commit 3a634136b9d92cc881bb4e6659093ad48940a4ac.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions