diff options
author | João Souto <joao.jpgs@hotmail.com> | 2020-02-27 19:30:41 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-27 14:30:41 -0500 |
commit | ff4b7b0921760f97e83ec34435f875e074f3d069 (patch) | |
tree | ccd09ccc27e15fa74fcf368ade135ebc408a3692 | |
parent | 1d26da6a478d96a03b08b5bf1ff93a277b69f550 (diff) |
Add clippy to /tools/lint.py (#4132)
-rw-r--r-- | .github/workflows/ci.yml | 4 | ||||
-rwxr-xr-x | tools/lint.py | 36 |
2 files changed, 33 insertions, 7 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 656a72ed3..c4e56bad9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,10 +122,6 @@ jobs: if: matrix.kind == 'lint' run: python ./tools/test_format.py - - name: Clippy - if: matrix.kind == 'lint' - run: cargo clippy --all-targets --release --locked -- -D clippy::all - - name: Build if: matrix.kind == 'test_release' || matrix.kind == 'bench' run: cargo build --release --locked --all-targets diff --git a/tools/lint.py b/tools/lint.py index 6adbf0b69..2a01ffd5b 100755 --- a/tools/lint.py +++ b/tools/lint.py @@ -4,16 +4,37 @@ import os import sys +import argparse from util import enable_ansi_colors, git_ls_files, root_path, run -from util import third_party_path +from util import third_party_path, build_mode from third_party import python_env def main(): enable_ansi_colors() os.chdir(root_path) - eslint() - pylint() + + parser = argparse.ArgumentParser() + parser.add_argument("--js", help="run eslint", action="store_true") + parser.add_argument("--py", help="run pylint", action="store_true") + parser.add_argument("--rs", help="run clippy", action="store_true") + args = parser.parse_args() + + did_fmt = False + if args.js: + eslint() + did_fmt = True + if args.py: + pylint() + did_fmt = True + if args.rs: + clippy() + did_fmt = True + + if not did_fmt: + eslint() + pylint() + clippy() def eslint(): @@ -49,5 +70,14 @@ def pylint(): quiet=True) +def clippy(): + print "clippy" + current_build_mode = build_mode() + args = ["cargo", "clippy", "--all-targets", "--locked"] + if current_build_mode != "debug": + args += ["--release"] + run(args + ["--", "-D", "clippy::all"], shell=False, quiet=True) + + if __name__ == "__main__": sys.exit(main()) |