4 ms·
My problem with formatting any code like this is that it can make diffs painful. I agree that this looks better but I would say only marginally so. And I real
by sodapopcan 6y ago
My problem with formatting any code like this is that it can make diffs painful. I agree that this looks better but I would say only marginally so. And I really have no problems reading code that isn't lined up like this. I don't really have a high care level, though. I'm happy to go with the team on this one.
- hn_throwaway_99 6y agoI don't see why you think it would make diffs painful. If anything, in my experience it makes diffs easier because each chunk can be put on it's own, independent line so that if you change anything it is constrained to the relevant line.
- dragonwriter 6y agoIt makes diffs harder because maintaining the indentation rule (sometimes, depending on what is on other lines) requires changing every line of the query if you go from “INNER JOIN” (equally, outer/right/cross join) to “LEFT JOIN” (equally, full join).
- fiddlerwoaroof 6y agoNearly every diff tool has -w for this, though: main main annoyance with GitHub is that I can’t enable this as the default diff mode.
- sodapopcan 6y agoYep—`-w` is the default when I blame in my editor but ya, github is really the problem.
- majewsky 6y agoAt least GitHub now has a UI for enabling it. I remember the dark ages when you had to put ?w=1 on the URL like some sort of animal.
- hn_throwaway_99 6y agoThe indentation rules never change. Fortunately, "SELECT" at six letters is as long as the longest first word that starts a clause, which is why when doing, for example, a "LEFT JOIN" you line up the "LEFT" and not the "JOIN, e.g. SELECT a.foo FROM alpha a JOIN beta b ... would become SELECT a.foo FROM alpha a LEFT JOIN beta b ... Any diff tool correctly highlights the only change is the LEFT.
- sodapopcan 6y agoYa, was thinking after I submitted that SELECT and DELETE are always going to be the longest anyway, so it always works for SQL!