4 ms·
I will agree with you that shitty linters are shitty. > Maybe you want multiple spaces to vertically align code in a complex set of logic. Maybe you want to ex
by aidenn0 6y ago
I will agree with you that shitty linters are shitty.
> Maybe you want multiple spaces to vertically align code in a complex set of logic. Maybe you want to express things on multiple lines to break them up. Maybe you have deep nesting so you want to go from 4 spaces to 2. Maybe you want no braces in a single line if statement except in certain cases. This could go for pages. Poof! All gone. You can't do any of it anymore.
Literally none of these should be flagged by a linter IMO, except maybe the braceless if[1]. If those checks are present I would disable them. Those sound more like a code-styling tool, and is particularly egregious because every single thing you mentioned could be automatically changed by a code formatter!
Examples of things a good linter will pick up on: Unused variables, dead code, use before initialization.
The most absurd case of a linter helping was when fixing an unused variable lint warning actually allowed me to speed up a program by almost a factor of 100 (it precomputed a value and then called the version of the function that didn't use the precomputed value in a tight loop).
[edit]
Do you disable warnings in compiled languages? Note that linters for non-compiled languages are used at least partly to catch things that would be warnings or errors in a compiled language.
1: No braces in an if statement should probably be flagged when the THEN clause is on a separate line because it's a future bug waiting to happen, but I can see the argument for allowing it when it's a single-line statement. OTOH if (foo) {bar();} is only 2 characters longer and 4 if you put whitespace between the braces
- lowercased 6y ago> If those checks are present I would disable them. The purpose of linters on a team - so I've been told - is so that no one has to argue about formatting anymore. So now we just get to argue about what rules we can enable/disable? Even though it's perfectly legal to disable linting for lines or files, most of the time when I do it, it's flagged by someone in review, and there's some discussion and I'm forced to rewrite and remove my disable and go back to whatever the linter was forcing. "These rules are there for a reason, and were put together by people with more experience and smarter than us - we shouldn't go disabling things whenever we want just because we don't like them or think we know better". (amalgamation of multiple comments from people stopping me disabling lint checks in specific situations). This doesn't happen every time, but enough that the occasional 'disable' isn't something I can just do without worrying it will end in multiple hour discussions. Which is probably what people want - unquestioning conformity to "the one true way".
- aidenn0 6y ago> The purpose of linters on a team - so I've been told - is so that no one has to argue about formatting anymore. Code formatting is just one feature a linter may have (e.g. shellcheck[1] and pyflakes[2] are definitely linters but don't have code formatting checks). I disable all the formatting checks in my linters because if I want to enforce a formatting standard, a code reformatter is probably a better way to do it. 1: https://www.shellcheck.net/ https://www.shellcheck.net/ 2: https://pypi.org/project/pyflakes/ https://pypi.org/project/pyflakes/
- Izkata 6y ago> The purpose of linters on a team - so I've been told - is so that no one has to argue about formatting anymore. People who argue this are, I believe, missing the forest for the trees. A short on-the-spot version of something I've had in mind for a long time: almost everyone has a slightly different style that they fall into and the individual styles arent necessarily difficult to understand AT LEAST WHEN USED ON THEIR OWN, AND NOT MIXED WITH OTHER STYLES. Your Brain Adapts To A Given One, When Reading That Style. It May Still Feel Like Stuttering, But Once Adapted It's Fully Readable. Evensomeonewithareallybizarrestylecanbereadwithalittleefforttofigureoutwhatthatstyleis. The problemcomeswhen You have MULTIPLE people OnA team, and THE SYLES getallmixedupsoittakes a lot moreefforttofigureoutwhatTHEFUCKisgoingon. Linting is all about picking a style and sticking with it so the code doesn't end up with multiple personality disorder. > Even though it's perfectly legal to disable linting for lines or files, most of the time when I do it, it's flagged by someone in review, and there's some discussion and I'm forced to rewrite and remove my disable and go back to whatever the linter was forcing. "These rules are there for a reason, and were put together by people with more experience and smarter than us - we shouldn't go disabling things whenever we want just because we don't like them or think we know better". (amalgamation of multiple comments from people stopping me disabling lint checks in specific situations). When this happens, I think it should open a wider team conversation about whether that particular rule is actually worthwhile, or whether it goes against what your team wants and should be altered/disabled. Unfortunately, I have encountered a couple rules where the linter wasn't configurable enough to get what we wanted as a team, so there's definitely reason to allow per-instance disabling...