diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 656a72ed33..c4e56bad9b 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 6adbf0b699..2a01ffd5b8 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())