I wasn't saying that linters were a problem, I was saying that the over application of linters was a problem.
In general, overly broad application of a tool is a problem, wether in programming or not. Linting is a tool, it is possible to over apply it, and I argue that this is regularly done with Rubocop.
> So we welcome the consistency and focus on something we care more about.
What is the goal of consistency?
i don't know anything about linters or rubocop, but i do think you are wrong on this narrow point.
consistency is good in and of itself, it is not merely a symptom of your true goal of maintainability or readability as you mention in op.
id prefer someone/something that is consistently wrong to someone/something that is more often right, but randomly wrong. consistency implies methodology that can be changed and adapted, as opposes to simple mistakes that have to be assiduously monitored for.
you can train a person into a different habit and refactoring is much easier than bug hunting.
It can't be, because consistency is only a concept with no intrinsic value. The value is based on the relationship between the concept and the application.
You can say "consistency in code is good" or "consistency in code is bad", but then you've made an argument and you need back that up with reason.
> id prefer someone/something that is consistently wrong to someone/something that is more often right, but randomly wrong.
Just to be clear, we're not talking about bugs here, we're talking about style where there's, sometimes subjectively, "better" or "worse" more often than "right" or "wrong".
> consistency implies methodology that can be changed and adapted, as opposes to simple mistakes that have to be assiduously monitored for.
Consistency doesn't imply anything of the sort, but if you want to apply consistency to a problem with the goal of being able to change every instance of something you're not really solving a problem, unless your actual goal is consistency, which I argue isn't actually a goal at all.
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)?Whether you use ' or " for strings, or the %d shorthand or fully formed arrays in Ruby has nothing to do with the correctness of your code.
When these are trivial, it's not such a big deal - perhaps a bit of friction for developers, but not in a way that slows them down significantly. Rubocop does occasionally get into style rules that can change what your code is trying to communicate though, and those can often have negative effects.
Rubocop and other linting tools do aid in readability somewhat, but I agree that a lot of the time they can either focus on trivial concerns that don't really make a large impact on readability (things like which quote characters to use), and in some cases actively harm readability (the examples from this article).
Personally, my feeling on tools like Rubocop is that where they break down is often more important than the areas where they help (high level structure and communicating intent), and often the benefits of consistency in syntax are frankly pretty marginal, but I can get people having different opinions on this. There's certainly Rubocop rules I enable and get value from, but I do have quite a lot turned off and don't really notice much impact from it.