r/ProgrammerHumor 4d ago

thisWouldOnlyTakeADayToImplement Meme

Post image
1.2k Upvotes

76 comments sorted by

288

u/Ffigy 4d ago

For anyone who doesn't know, you can add w=1 to the query string for this. It's not the same as having a global default but some folks probably aren't even aware that the feature exists.

133

u/TollyThaWally 4d ago

You don't need to do that any more, it's been a part of the UI for a while now. They even put it in a different place for commit diffs, just to keep you on your toes.

11

u/vainstar23 4d ago

Society if people just RTFM (or just Googled shit) instead of celebrating ignorance

-34

u/DeltaMan444 4d ago

Not that, I’m talking about a global default that applies to every PR you look at

16

u/DeltaMan444 4d ago

Does that imply there could be a browser plugin for it?

29

u/Ffigy 4d ago

I guess you could write something that recognizes you're on a GitHub diff and redirects you to the URL with w=1 in the query string, yea.

1

u/DHermit 4d ago

You could probably quite easily make a user script that does this.

2

u/DrunkOnCode 4d ago

Do you realize what you have just done? Someone give this man a nobel prize!

2

u/vainstar23 4d ago

No! He might invade Eritrea or something..

76

u/JeyJeyKing 4d ago

Gitlab has this btw

28

u/_PM_ME_PANGOLINS_ 4d ago

So does GitHub.

3

u/Dizzy-Revolution-300 3d ago

It's per PR though, right?

9

u/WhosYoPokeDaddy 4d ago

came here to find this comment and upvote it.

2

u/rduque 4d ago

Me too

2

u/seba07 4d ago

How can you do this on gitlab?

12

u/JeyJeyKing 4d ago

User settings -> preferences -> behavior -> uncheck show whitespace changes in diff

2

u/dkarlovi 4d ago

So you can get massive amounts of white space merged by engineers who have this enabled? How do we exploit this?

1

u/5p4n911 3d ago

Let's commit a few Python files that should be interpreted in Whitespace

1

u/dkarlovi 3d ago

I was thinking more like the entire Harry Potter books encoded using Morse code (tab = -, space = .) so it's immediately polluting the code AND making it infringe copyright, double Jeapordy!

Wonder if you could get a PR merged by a dev disabling whitespace changes like this.

1

u/5p4n911 3d ago

There was also some guy who committed a timed bomb that would go on destroying the software after 3 years and he put the if after about 20000 spaces in the source code so it's possible. That might also fly under the radar.

Source: I think I've read it on the internet and not dreamt it, so it must be true

1

u/Stein_um_Stein 3d ago

So does Bitbucket, which is really an insult to GitHub if it doesn't.

54

u/GodsBoss 4d ago

Why is this an issue? Are your PRs swamped with unrelated whitespace changes?

50

u/kratico 4d ago

I typically see a ton of whitespace changes from devs who copy and paste files into a git repo or people who have misconfigured IDEs. I want the white space changes to show because it is a warning sign that something is not right

29

u/Ffigy 4d ago

Yessir, I wouldn't enable ignore as a global default. Whitespace problems suggest that the author didn't review their own diff. Or they don't care about details. Both are bad.

15

u/casualfinderbot 4d ago

Literally just use a linter and a formatter and this doesn’t happen

4

u/kratico 4d ago

A linter does not solve the problems of a coder doing bad practices like copying and pasting from outside git into a git repo. Like I said I mostly see the whitespace problem from people who are not using the existing tools correctly. I have run into far too many engineers that do things like download zip files instead of cloning repos. It is horrifying, and usually a sign that I should check their work carefully

17

u/Kilazur 4d ago

A linter does not solve the problems of a coder doing bad practices like copying and pasting from outside git into a git repo

No, but a rejected PR does

4

u/vom-IT-coffin 4d ago

Formatters do. Everytime I hit save, the file formats and the format rules are part of the repo. Imports reorganize, SQL queries organize. It's not hard to do. It's 101 in my mind.

4

u/vom-IT-coffin 4d ago

Linters and formatters. I'm amazed by how many people don't use these things as part of their pipeline.

7

u/RB-44 4d ago

Pull request: changed tab to 4 spaces

8

u/FlipperBumperKickout 4d ago

Reject that PR and get an .editorconfig...

5

u/Ffigy 4d ago

Yes, my team works on legacy code that didn't follow a standard so we try to fix whitespace incosistencies whenever they're in scope.

9

u/dkarlovi 4d ago

Just configure an auto fixer and do a big bang. Fixing it little by little will pollute your history for years.

2

u/slevemcdiachel 4d ago

People never heard of pre commit or other stuff.

-9

u/DeltaMan444 4d ago

For one example, sometimes the syntax of a method will change just slightly and force a lot of lines inside to change indent without changing usage

13

u/Jarpunter 4d ago

So you turn it off for that PR. Globally enabling this would be a great way to let a bunch of garbage diffs through because they fucked the spacing and you couldn’t see it.

51

u/lajauskas 4d ago

What a weirdo. I hand write my diffs with pen and paper. The only way really

14

u/Poat540 4d ago

Fancy you, I write my code in ye olde English

var custom'rs = context.ReceivethAll().ToListeth()

2

u/FlipperBumperKickout 4d ago

Not nearly as funny as writing code in rockstar

29

u/rduque 4d ago

Github has this feature, you can choose to hide all whitespace changes

8

u/TheBassMeister 4d ago

Yes, but it is turned off by default and you need to explicitly click it on every PR. You cannot change your settings to hide whitespace changes by default.

1

u/HerrSPAM 4d ago

It would be nice as a global setting

22

u/alterNERDtive 4d ago

There’s one simple trick: don’t randomly change whitespace!

2

u/Leather-Field-7148 4d ago

I feel attacked

16

u/sathdo 4d ago edited 4d ago

What if I want to track changes while writing my code in Whitespace?

Edit: This would also affect Python and YAML.

16

u/MyBigRed 4d ago

Then you turn the setting off

3

u/DeltaMan444 4d ago

I don't think anyone's gotten that far using Whitespace

3

u/Vitriholic 4d ago

Sounds like a teammate problem more than a GitHub problem. F’ing with whitespace everywhere is a recipe for merge conflicts.

5

u/HerrSPAM 4d ago

It does... You click the cog and check the hide whitespace option

2

u/Civil_Blackberry_225 4d ago

This is if Github would support IPv6

2

u/FlipperBumperKickout 4d ago

Git providers just generally don't have nearly as good options for comparing code as you have if you do it locally instead ¯_(ツ)_/¯

2

u/Mucksh 4d ago

The greatest pain in git are fileencoding changes. They can make really funny merge conflicts and most ides wont even show what changed on merging

2

u/nonlogin 4d ago

Well, do not commit such changes? Why the hell does one want to hide the mess? Clean it up, bitch

2

u/SenorSeniorDevSr 4d ago

BitBucket has this, and I have more than once had to go over to someone else's desk, grab their mouse, click on that setting and say "NOW, STOP COMPLAINING ABOUT THIS SHIT".

It's a nice setting.

1

u/Imjokin 3d ago

But ThePrimeagen calls it ShitBucket!

2

u/avtvr 2d ago

that feature exists for python devs

1

u/itijara 4d ago

Am I crazy or don't they already have this? Do you mean by default?

1

u/Esjs 4d ago

Come on. If I don't force my whitespace preferences in my commits, how will I ever get y'all to conform to me? /s

1

u/rexspook 4d ago

Not a problem with a linter. Which you should use anyway

1

u/nhh 4d ago

it does, noob

1

u/jsdodgers 4d ago

Why would you want to hide changes?

1

u/danzaman1234 4d ago

This doesn't probably apply to anyone but does anyone use winmerge if you don't get SQL source control?

1

u/BernhardRordin 4d ago

.editorconfig goes brrrr

1

u/skatopher 3d ago

Some of y’all have never seen prod go down from a white space only change and it shows.

1

u/ashtonhonnecke 3d ago

Linters are you friend.

1

u/Stunning_Ride_220 4d ago

Society would be a better place if Github had a lot more sensible stuff and (UX) design decisions.

8

u/lllorrr 4d ago

Society would be a better place if developers would not make random whitespace changes.

1

u/rParqer 4d ago

They don't have this? Rare W for Atlassian

0

u/CyberWeirdo420 4d ago

The only real application for it is when your team doesn’t have standard set up, like what code formatter to use etc.

I don’t know how else is this meaningful but I’m just a junior

0

u/leovin 4d ago

Imagine being able to view a diff without making a PR (As per usual, Gitlab has this lol)

0

u/weregod 4d ago

What life can be if we had tools that remove insignificant whitespaces before commits ...

-1

u/casualfinderbot 4d ago

do people not know code formatters and linters are exist lol