4 ms·
So are you saying sometimes you want to initialise a variable without ever doing anything with it afterwards? That that's not the result of a typo down in your
by Vinnl 6y ago
So are you saying sometimes you want to initialise a variable without ever doing anything with it afterwards? That that's not the result of a typo down in your code in the vast majority of cases?
I mean, I'll be the first to agree that blocking your development in the heat of it over some stylistic issue like quote styles is counter-productive, but if those rules are turned off and the rest help you catch actual bugs (and it's hard to argue that it does not), then that's surely a plus?
(Also, why wouldn't linters know types?)
- kristopolous 6y agoIt hasn't been my experience. I have had to deal with linters probably about 15,000 or so hours of my work life (luckily that's only about a third). It's been probably between 99.4% and 99.8% just acrobatic dog tricks to satisfy the linter. It's not like I'm some grumpy malcontent that hasn't given it a go. If you want to use it go ahead, I just thought I'd be standing in a larger crowd
- jakear 6y agoNot sure what these “dog tricks” you speak of are. Have the linters you’ve worked with had ”—fix” options such that you don’t need to do anything besides save the file? Aside, it’s funny that you dismiss linters as being for “type A folks who must have everything in its right place”, but your concerns seem to be that you want things in their right place and the linters won’t let you. The folks who use linters have decided worrying about it isn’t worth it and just let the linter do its thing, which is less “Type A” than how you describe yourself.
- kristopolous 6y agoThat wasn't me. It's a nice visual but I think it's mostly for fun. I'd say it's mostly hammers on porcelain. A coder carefully creates something (porcelain) and then the hammer comes around and insists it has to be a perfectly shaped commodity thing. Same reason and emotion I guess behind both.
- jakear 6y agoOh, misread authors I guess. In my case, 99% of the time I’m fine with what the linter spits out. In cases where I want a particular structure I just wrap ignore directives around the section and move on with my life
- kristopolous 6y agowe probably just code different things for a living. It's a big world. I'm sure they're useful in your job.
- Vinnl 6y agoCould it be that the problem with the linters you've experienced was that they were just configured far too strictly about things that don't matter too much, rather than linting itself being the problem? I've got my linters set up pretty loosely, but the things that are enabled have definitely helped me detect bugs earlier and quicker, and I really don't see how anyone could be against that.
- kristopolous 6y agowell sure. There aren't bad tools just bad practitioners, sure. Certain tools give more affordance to certain use cases and maybe that's the issue. For instance something where I am the culprit would be in PHP. I like PHP. I think it's a convenient and powerful language. Someone could take my linter arguments and weaponize them against PHP because it's too easy to do terrible things with it. Then I'd be the one on the other side of the argument all of a sudden, standing in defence of this easy to use language with handy powerful abstractions that can trash a system in a few keystrokes. I think the difference is when we can come to an agreement that say, PHP is a very powerful tool in competent hands and a very dangerous tool for the foolish. Going back to the topic at hand, I think the foolish side of linting is the dominant application I see in the wild. I used to use a barrage of proto-linting static analysis tools in my CVS scripts during the wild C days because pointer logic and memory management was notoriously tricky and gcc 2.x was notoriously forgiving. These tools could save days of debugging, really, yes, days. If we can do that for say python it'd be great. Something saying "Oh I see you are doing a list[1:] in a tight loop, have you thought about collections.dequeue? it may be a better option" - those things are things I do actually forget about and would find helpful. It'd have to be voluntary though. Prod me a bit but then let me dig my own grave if it's a mistake. That's what the power of computing is also about.
- Vinnl 6y agoYep, I can definitely agree there. That said, I'd argue against strict stylistic rules, not against linters in general. For example, the common Javascript linter (ESLint) has a setup wizard that allows you to choose whether you just want to check for bugs, or also enforce style conventions, and will enable a predefined set of rules depending on your choice. The bug-spotter is the one that's preselected. This is a very reasonable approach to me.