FX Lint

對已修改的檔案執行原始碼 Linter

Usage: fx lint
          [--dry-run] [--verbose] [--fix]
          [--all]
          [--files=FILES,[FILES ...]]
          [--target=GN_TARGET]
          [--git] [-- PATTERN]

  --fix     If supported by the linter tool for the target language,
            attempt to apply recommended fixes
  --dry-run Print the linter commands but don't run them
  --verbose Print the linter commands before running them
  --all     Lints all code in the git repo under the current working
            directory.
  --files   Allows the user to specify files separated by commas or (with
            quotes) whitespace. Basic globs are supported, for example:
                fx lint --files=foo/*
            Or for more advanced filename pattern matching, you can use
            double quotes with command substitution:
                fx lint --files="$(find some/path -name '*.cc')"
  --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
            linted.
   -- [PATTERN...] -additional -args -for -linter
            For --all or --git, passes along PATTERNs to `git ls-files`
            to filter what files are affected. The first argument starting
            with a dash, and all arguments thereafter, are passed to the
            linter command (positioned before the filename). Used in
            combination, the pattern can constrain which linter is selected,
            so linter options are only applied to the expected linter
            program.

Examples:
    fx lint -- "*.fidl" --include-check no-trailing-comment
    fx lint --files=sdk/fidl/fuchsia.sys/service_provider.fidl \
            -- --exclude-check string-bounds-not-specified
    fx lint --verbose --files="$(echo sdk/**/*.cc sdk/**/*.fidl)"

Lint 原始碼