3 ms·
I think an automatic code formatted actually makes one’s job easier, not more complicated.
by loloquwowndueo 3y ago
I think an automatic code formatted actually makes one’s job easier, not more complicated.
- max_sendfeld 3y agoAbsolutely! I'm grateful that I don't have to worry about code formatting any more. But I remember in one of my earliest job the company used style checkers as a pre-commit hook that rejected your commit if they found trailing whitespace. That was before code formatting was part of your IDE. (Especially for us front end devs who used Notepad++ rather than an IDE at the time). And notepad++ had no easy way of showing trailing whitespace. So every commit was a dance of commit -> read rejection log -> remove trailing whitespace -> commit again.
- EZ-E 3y agoI have memories at my post grad school where any deviations from the expected code source formatting led to a -1 on the mark. On the first few projects it was not rare to see students getting marks well into two or three digits negatives.
- bluGill 3y agoThings that don't matter much. A nice consistent style is good to have, but it isn't something worth worrying about that much.
- hudell 3y agoI once worked on a project that would not even compile if a function had a param without a comment explaining the purpose of that param written with a specific format. Every comment was validated on compile time, you couldn't even comment code just to test something. Life was hell.
- yakshaving_jgt 3y agoWhat's stopping you from configuring your editor to automatically strip trailing whitespace on save?
- max_sendfeld 3y agoMostly the fact that this was 15 years ago :-)
- skirmish 3y agoCode reviewers that made me type in trailing whitespace that editor stripped: "this change is on lines you are not modifying". Still makes my blood boil many years later.
- mlinhares 3y agoThat completely removes a whole slew of useless comments when people are reviewing code, it's such an amazing win, every single language should have it's styleguide published and a tool that forces it without any options.
- rTX5CMRXIfFG 3y agoThe key to style guides is to not have so many rules. Agree on the number of spacing and where to put braces. Past that, it’s obsessing on form over function, which you cannot control simply by virtue of having many people work together on the same codebase. You should worry more about how things are named, the number of abstractions used, and whether the code has any comments explaining the writer’s intent.
- kevindamm 3y agoYes, but, on the other hand having a detailed style guide does make for short and simple debate during code review.
- zaptheimpaler 3y agoThis is broadly what reasonable people believe, but there are crazy people who WILL obsess over form and nitpick your whitespaces or other trivial bullshit if given a chance. An authoritative style guide shuts down many such detours.
- thfuran 3y agoIt's not even just about obsessive nitpicking. There are people who, for example, prefer code with spaces around the parens for conditions and people who don't. If there's no enforced style guide and one from each camp end up touching the same code, you're likely to get a bunch of pointless noise in the diffs. Even if no one is going to hold up a diff arguing over it, it makes it harder to review changes.
- durumu 3y agoI think you can have as many rules as you want as long as there's something like black or rustfmt, just a script you run that auto-formats your code. You never have to worry about the rules because there is no configuration thus nothing to argue about. Sometimes your code gets formatted weird but who cares, just do your work.
- deleted 3y ago[deleted]