Skip to content

RuboCop taking issue with old source #339

@smalleel

Description

@smalleel

The latest version of RuboCop seems to be getting caught on a few issues on most of the recent pull requests that aren't related to the commits in the pull requests. Here's one of the common complaints from RuboCop:

Offenses:

bin/t:21:1: W: Do not shadow rescued Exceptions
rescue Interrupt ...
^^^^^^^^^^^^^^^^
lib/t/identicon.rb:33:7: C: Use bit.zero? instead of bit == 0.
      bit == 0 ? "\033[48;5;#{@bcolor}m" : "\033[48;5;#{@fcolor}m"
      ^^^^^^^^
lib/t/printable.rb:139:7: C: Use concat instead of push(*).
      lines.push(*Array.new([3 - lines.length, 0].max) { '' })
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lib/t/rcfile.rb:23:60: C: Use empty? instead of size < 1.
        raise(ArgumentError.new("Username #{username} is #{possibilities.size < 1 ? 'not found.' : 'ambiguous, matching ' + possibilities.join(', ')}"))
                                                           ^^^^^^^^^^^^^^^^^^^^^^
lib/t/rcfile.rb:121:64: C: Use 0o for octal literals.
      File.open(@path, File::RDWR | File::TRUNC | File::CREAT, 0600) do |rcfile|
                                                               ^^^^

33 files inspected, 5 offenses detected
RuboCop failed!

This seems to be happening with a bunch of recent pull requests including:
#335
#320
#322
#338

I was able to reproduce there complaints from RuboCop with an unmodified clone of the most current release as well.

Was RuboCop updated at some point and is now upset with some pre-existing items in the source? I see that in the gemfile on line 17 is specifies any version >= 0.37. If the issue is with RuboCop becoming more stringent, should we address these issues? Alternatively, we could specify a version of RuboCop that's old enough not to care about these issues, but that seems like bad practice.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions