News for hackers. Stuff that matters.
Re:My Beef with RuboCop by gurkendoktor on Thursday November 19, 2020 @03:31PM (#25153994)
I feel the discussion about consistency is moot because, in my experience, linters often have a different idea about consistency than humans.

Let's say I have the following three methods:

    def foo
      if broken?
        :error
      else
        @x
      end
    end

    def bar
      if broken?
        5
      else
        @y
      end
    end

    def qux
      if broken?
        nil
      else
        @z
      end
    end
If Rubocop forces me to reformat the last method as a one-liner because nil is returned implicitly, is this really more consistent (because it follows Rubocop's predictable rules)? Or is it less consistent (because these functions lose their common structure)?

There are no comments on this comment yet.