-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove lint rules for max-line #247
base: main
Are you sure you want to change the base?
Conversation
In most cases, a restriction of lines of code is a stylistic choice. In most cases, I'd agree with you: The rules for the max-length of a function often are not helpful and lead to refactoring steps that are mostly not required. However, removing the rule altogether doesn't seem to be the solution here. Also, I don't see any reasoning of removing the rule for a maximum length for a file. We can discuss when this rule applies (not sure if 300 is too low) but not if. |
What's the solution if someone wants the function/file to keep the length despite the warning? We can't just let the warning stand since large portions of a file may be underlined in most IDEs, which makes the code and other warnings indecipherable. Will a simple @eslint-disable of the rule without further ado in the appropriate position suffice? If so, I can change this PR to reducing the severity level from "error" to "warn". |
For files, I'd still go with "error". As mentioned before, we can discuss about the length that is allowed. Regarding function lengths: IMO, the route we are currently taking should be the way. If a function is too long but it is certain that it is totally fine, then add a comment and disable the warning for that specific function. This linting rule should inspire a developer to hold still and think if the design of the written function can stay as is or is a function that would be refactored given the next time someones comes near it. |
There's just no LOC-based rules to make anyone work in a sensible fashion, and it may easily produce the opposite. Since we two are probably stuck now, I'll address this topic in the next meeting where we can get majorities in voting. |
Summary
I don't think the rules
"max-lines"
and"max-lines-per-function"
should be kept and that they didn't stand the test of time.Limits are especially irrelevant when we're operating in an environment where many lines of code may contain very easy to digest complexity like:
As illustrated, LOCs do not hold any meaning regarding complexity. I'm still all for keeping functions as short as possible and separating code by concerns, but the current state of linting blocks valid implementations. It's the wrong hammer for this screw, and I don't think there's an automatable solution to this.