Live data from Hacker News

Reformatting 100k Files at Google in 2011

laurent.le-brun.eu

81–90 of 162 posts

Re: Reformatting 100k Files at Google in 2011

#81
post #2

Autoformatting is so nice. Crazy to think that formatters only became popular after `gofmt`. I also found this related quote from Russ Cox intriguing: "Most people think that we format Go code with gofmt to make code look nicer or to end debates among team members about program layout. But the most important reason for gofmt is that if an algorithm defines how Go source code is formatted, then programs, like goimport…

Java IDEs have had optional reformat on safe for a long time.

https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclip...

Re: Reformatting 100k Files at Google in 2011

#82
post #71
post #16

Earlier quoted context omitted.

If you do it that way, then what should be a 1-line BUILD file change turns into something that changes every line. It distracts from the actual purpose of the future change. Many directories aren't touched for long periods of time. A few months from now someone tries to make a 1-line change and is unpleasantly surprised they have to deal with tons of seemingly spurious formatting changes. Not good. Putting the time…

Make the one line change be a commit, then the reformatting be another one, review only the first one. It shouldn't be a problem with a proper review system.

If every engineer needs to make two commits when they change the build file, that's a higher cost compared to having people dedicated to the migration.

Re: Reformatting 100k Files at Google in 2011

#83
post #81
post #2

Autoformatting is so nice. Crazy to think that formatters only became popular after `gofmt`. I also found this related quote from Russ Cox intriguing: "Most people think that we format Go code with gofmt to make code look nicer or to end debates among team members about program layout. But the most important reason for gofmt is that if an algorithm defines how Go source code is formatted, then programs, like goimport…

Java IDEs have had optional reformat on safe for a long time. https://help.eclipse.org/latest/index.jsp?topic=%2Forg.eclip...

They have, but the different IDEs do not format equivalent and are way too easy to reconfigure to personal preference.

Re: Reformatting 100k Files at Google in 2011

#84
post #52
post #32

I'd be curious what role "global approvers" at Google/Google's scale typically have/how many are there/what's the process?

I was one of the global approvers (and also on the Python team until my role at Google was eliminated recently). I no longer have access to the stats, but from my memory, there are currently 50+ global approvers depending on how many are still considered active. Typically, code authors would create a proposal by filling out a doc template. It's usually light weight and also accompanied with examples or full set of th…

Just curious, what kind of global changes do you usually make? And what is the process of becoming an approver?

Re: Reformatting 100k Files at Google in 2011

#85
post #23
post #2

Autoformatting is so nice. Crazy to think that formatters only became popular after `gofmt`. I also found this related quote from Russ Cox intriguing: "Most people think that we format Go code with gofmt to make code look nicer or to end debates among team members about program layout. But the most important reason for gofmt is that if an algorithm defines how Go source code is formatted, then programs, like goimport…

I’ve wondered before whether the world would be well served by a programming language (or source control system, I suppose) that just stores ASTs in files rather than text code. When users open the file the editor formats to whatever their personal preference is, then saves edits back to the AST. It really is dumb to be arguing over tabs vs spaces, after all.

No, because there are no good tools for this format. It's a classic "worse is better" problem - a programming language cannot succeed unless its source code format is unix text files.

Re: Reformatting 100k Files at Google in 2011

#86
post #40
post #23

Earlier quoted context omitted.

I’ve wondered before whether the world would be well served by a programming language (or source control system, I suppose) that just stores ASTs in files rather than text code. When users open the file the editor formats to whatever their personal preference is, then saves edits back to the AST. It really is dumb to be arguing over tabs vs spaces, after all.

> It really is dumb to be arguing over tabs vs spaces, after all. In an in-house dialect of Haskell I used to work with, we solved this problem by just making tabs a syntax error. Never had any problems. (I think tabs might be have been allowed inside strings.)

Simple, elegant, and wrong.

Re: Reformatting 100k Files at Google in 2011

#87
post #68

Earlier quoted context omitted.

Does that mean that a file with a syntax error is not able to be saved?

language servers have pushed things to inspecting source code while programmer has partially written code, so having a kind of (invalid-span content="garbage") node in AST helps

[deleted]

Re: Reformatting 100k Files at Google in 2011

#88
post #77
post #67

Earlier quoted context omitted.

You didn’t have Rosie to automatically split up your changes and send them out yet?? That must have been rough. LSCs are way easier now

Yeah I'm surprised by that as well. As far as I remember, Rosie started out in 2010 and people were using in 2012. Maybe the clustering/splitting didn't support this use-case or it wasn't well-known enough?

From my memory, extremely large but semantically simple changes still used global approvers since it wasn't considered worth the effort to get approval from hundreds or thousands of individual OWNERs using rosie. Also, with a change of this magnitude, especially one affecting BUILD files, it might not have been possible to create the mega-CL that rosie uses, but I don't remember specific limitations on that.

Re: Reformatting 100k Files at Google in 2011

#89
post #25
post #23

Earlier quoted context omitted.

I’ve wondered before whether the world would be well served by a programming language (or source control system, I suppose) that just stores ASTs in files rather than text code. When users open the file the editor formats to whatever their personal preference is, then saves edits back to the AST. It really is dumb to be arguing over tabs vs spaces, after all.

At that point you could even use different languages. Maybe you like programs that look like Lisp and I don't. There was a project at Microsoft Research in the late 1990s/early 2000s that did exactly this - storing ASTs in source control instead of code - but the name escapes me at the moment.

Was it Intentional programming? I remember it being described as something similar to what you say, but the Wikipedia shows something slightly different.

https://en.wikipedia.org/wiki/Intentional_programming

Re: Reformatting 100k Files at Google in 2011

#90
post #52

Earlier quoted context omitted.

I was one of the global approvers (and also on the Python team until my role at Google was eliminated recently). I no longer have access to the stats, but from my memory, there are currently 50+ global approvers depending on how many are still considered active. Typically, code authors would create a proposal by filling out a doc template. It's usually light weight and also accompanied with examples or full set of th…

Just curious, what kind of global changes do you usually make? And what is the process of becoming an approver?

I was also global approver.

Examples of global changes include:

- changes to Buildifier that require updating existing files

- rename/refactor a function used everywhere in the repository

- fix the existing code before turning a lint warning into an error

- fix code that will break with a compiler update

Anyone in the company can propose this kind of change. The proposal will be reviewed by a committee (to ensure the change is worthwhile, that are mechanisms to prevent regressions, etc.) and by a domain expert (the team that owns the area).

Global approvers are people who often deal with this kind of changes. They usually come from the language teams (e.g. I knew the specificities that come with global changes touching BUILD/Starlark files).

Post reply on HN