If you don't care about mojom, you can stop reading now.
Building on the new mojom parser, we wrote a mojom formatter. You can invoke it in the mojo repo like thus: (Sync to head and run gclient sync)
./mojo/public/tools/bindings/mojom_tool/bin/linux64/mojom fmt <file/to/reformat.mojom>
Using the -w option will overwrite the specified file with the formatted content.
To show the sort of changes, that may happen, I have created an issue with the whole mojo repo formatted:
Some highlights:
Each attribute is now on its own line where appropriate.
Comments are properly indented.
The last enum value of an enum ends with a comma.
Empty structs are collapsed to a single line.
The idea is that the formatter will free us from having to think about formatting issues in mojom and could ideally be run on every save and as part of the presubmit checks. Please file bugs if you have any concern with the formatting.
azani