Remove funlen
I propose we remove funlen
.
- It causes unnecessary refactoring of code out into functions that are not a good fit. Some functions are easier to read linearly, even if long. Extracting code into smaller functions has a cognitive trade off. We have instances where a function has been extracted with zero DRY or cognitive benefit, and only done to appease the linter.
- It makes reviewing harder. We and occasionally contributors move a section of code because we've hit the limit. Whilst reviewing a change, it's harder to determine what was moved and unmodified compared to what was really modified as part of the change. A long function can come up as part of a review, but it should be able to be handled later.
- It changes the focus of the merge request. A small change might hit the limit and the focus is now on what to extract to escape the linter. This is not always obvious: what to extract out and refactor is not always the part you touched. This either results in a change of focus, or a poor and rushed refactor. This becomes a greater issue with community MRs.
- Refactoring a long function when it becomes obviously long is far easier and less damaging than refactors that occur solely to silence the linter.
- It doesn't live up to its name, it's not fun.
Some functions are truly unsuitably long, but I think we're able to detect this and eventually resolve it. This isn't in favour of them all of the time, it's in favour of the context and consideration of the cognitive trade-off.
Has this linter provided value, or should it be removed?
Edited by Arran Walker