4 ms·
Are your objections to Rubocop's dictates in tests only (or primarily) about the complexity rules? The complexity rules have always struck me as being of a who
by andrewem 6y ago
Are your objections to Rubocop's dictates in tests only (or primarily) about the complexity rules?
The complexity rules have always struck me as being of a whole different category thnan Rubocop's other rules. As you note, they're especially frustrating in tests.
Edit: by "the complexity rules" I mean https://www.rubydoc.info/gems/rubocop/0.27.0/RuboCop/Cop/MethodComplexity https://www.rubydoc.info/gems/rubocop/0.27.0/RuboCop/Cop/Met..., rather than the ones about variable naming, line length, etc.
- Fire-Dragon-DoL 6y agoMy problem with Rubocop is both in tests and in normal code. The rules about complexity hit both tests and production code, while the rules about tests obviously impact only that (experience limited to RSpec). A senior developer won't need Rubocop, it's a blocker rather than an improvement. In the rare occurrence where you have an undisciplined senior developer, it's worth exploring training or re-evaluating the standards in place. All in all, I keep thinking this is a problem of culture, if it's addressed there the value in Rubocop decreases drammatically. That being said, Elixir formatter is "ok-ish". I didn't have the same problem with it because it doesn't overstep the boundaries of styling. It did remove valuable structure of the code for the sake of formatting standardization, so again it's actually doing damage, but at least it doesn't force you to write code that is more cryptic to a human for the purpose of pleasing a machine.
- jon-wood 6y agoI agree Rubocop is heavy handed in the rules it hands down by default, its really useful as a formatter, but we have an internal gem at work which contains a set of less strict rules around things like complexity and method length to try and get away from having to play code golf all the time to keep Rubocop happy.