Google is committed to advancing racial equity for Black communities. See how.

fx format-code

runs source formatters on modified files

Usage: fx format-code
          [--dry-run] [--verbose] [--all]
          [--files=FILES,[FILES ...]]
          [--git] [-- PATTERN]

  --dry-run Stops the program short of running the formatters
  --all     Formats all code in the git repo under the current working
  --files   Allows the user to specify files.  Files are comma separated.
            Globs are dealt with by bash; fx format-code "--files=foo/*" will
            work as expected.
  --target  Allows the user to specify a gn target.
  --git     The default; it uses `git diff` against the newest parent
            commit in the upstream branch (or against HEAD if no such commit
            is found).  Files that are locally modified, staged or touched by
            any commits introduced on the local branch are formatted.
  --verbose Print all formatting commands prior to execution.
            For --all or --git, passes along -- PATTERN to `git ls-files`
            to filter what files are affected.

format-code source code