Introducing a mojom formatter

Visto 36 veces
Saltar al primer mensaje no leído

Alexandre

no leída,
29 feb 2016, 18:31:4329/2/16
a mojo-dev
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

Viet-Trung Luu

no leída,
29 feb 2016, 18:47:5829/2/16
a Alexandre,mojo-dev
Thanks, this looks like a great start!

But before everyone goes out and (re)formats all their mojom files, we should probably have some style bikeshedding first. ;-)

(Once that's done, maybe we can hook it into git cl format, or at least a presubmit check....)

--
You received this message because you are subscribed to the Google Groups "mojo-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojo-dev+u...@chromium.org.

Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos