5 ms·
What do you dislike about bugs being highlighted as you type, rather than first having to run your code?
by Vinnl 6y ago
What do you dislike about bugs being highlighted as you type, rather than first having to run your code?
- kristopolous 6y agoThis is just me btw, don't take offense: Because some things are better expressed in different rules. That's why some syntax is optional in the first place, that's the reason it was made that way. The flexibility is a very intentional feature. It wasn't an accident. 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. Not following optional syntax like having a space after a comma or a space before a parenthesis is not a software bug. It's a waste of time. The compiler doesn't care and I don't either. Instead it becomes a literal Blocking Issue most of the time. So instead of working on the actual blocking issues of the code base, you spend time doing "you did this here because of some context I don't understand and I'm not allowing it" You can't commit your code without conforming to it. Also because linters are dumb. They "spot" things that are perfectly fine as supposed bugs (because they don't actually know types or logic, they're just dumb syntax checkers) and you have to work around them to satiate them with the possibility of introducing new bugs to prevent some tripwire system from false positives. Compiler writers and language designers are the only people I've found who agree with me. It's fine for protecting against profound levels of incompetence but I don't do that and you probably don't either.
- Vinnl 6y agoSo 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.
- aidenn0 6y agoI 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".
- mbar84 6y ago> It's fine for protecting against profound levels of incompetence but I don't do that and you probably don't either. Everybody starts at a profound level of incompetence. If you want a junior to be able to make a contribution and you don't want to spend half of the pull request discussing mundane aspects of their code style, then linters and formatters improve the situation somewhat.
- lowercased 6y ago> What do you dislike about bugs being highlighted as you type many things "highlighted as you type" aren't "bugs". let greeting = "Hello " + user.name; Auto-fixing immediately flags this with "DAMN YOU USE A CONST!!!!" (multiple red squiggles that I have to hover and review). but... I might be making a change to it a few minutes later... but I've got some damn visual shit flashing in my eyes that "USE A CONST" concat strings? PREFER TEMPLATE!!! OK, ESlint, have it your way, please auto-correct that... `Hello ${ user.name}`; WTF? And... this is just one set of 'best practices' to learn - change per language/framework/team multiple times (sometimes in the same week) and it's... difficult. Yes, I'm an old-fogey. I have close to 30 years of muscle memory of using string concat and double quotes. "auto-fixing as I type" brings a huge interruption of flow, and THESE ARE NOT BUGS. They are style choices someone else is imposing on me. It doesn't make the code less buggy. It doesn't make the client any happier. If someone else coming in to the code is genuinely confused, confounded or severely impeded by let greeting = "Hello " + user.name; to the point where they have trouble deciphering the work, perhaps they're not terribly good at their job? Goodness help folks when new management comes in and demands a new 'better' style.
- anon_1_1_1 6y agolol r u anti spellcheck 2? bcuz idk why old fogeys thnk thtz so imprtant, is juts stylistic choice, u know xactly what i'm typng rite now, if u r genuinely CONFUZED, CONFOUNDED, OR SEVERELY IMPEDED by this, prhaps ur not terribly good at reading. i cant believe thoz guyz want to interrupt my flow by mking me fix my spleling whn thz ar not even bugs, i hv close to 30 yrz of muscl memory. I'm being facetious of course, but seriously, you are being very arrogant and rude with your suggesting that people who think stylistic standards are beneficial are bad at their jobs. Maybe they are also good at their jobs and genuinely have come to different conclusions than you and maybe despite your presumably high level of skill and experience, you're not great at developing a large team's productivity with your habits...
- Izkata 6y agoThe funniest part about that particular example is that it's highly likely you're using babel to support old browsers, and the compiled version just switches it back to string concatenation.