1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 23:34:47 -05:00

Add clippy to /tools/lint.py (#4132)

This commit is contained in:
João Souto 2020-02-27 19:30:41 +00:00 committed by GitHub
parent 1d26da6a47
commit ff4b7b0921
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 7 deletions

View file

@ -122,10 +122,6 @@ jobs:
if: matrix.kind == 'lint' if: matrix.kind == 'lint'
run: python ./tools/test_format.py run: python ./tools/test_format.py
- name: Clippy
if: matrix.kind == 'lint'
run: cargo clippy --all-targets --release --locked -- -D clippy::all
- name: Build - name: Build
if: matrix.kind == 'test_release' || matrix.kind == 'bench' if: matrix.kind == 'test_release' || matrix.kind == 'bench'
run: cargo build --release --locked --all-targets run: cargo build --release --locked --all-targets

View file

@ -4,16 +4,37 @@
import os import os
import sys import sys
import argparse
from util import enable_ansi_colors, git_ls_files, root_path, run 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 from third_party import python_env
def main(): def main():
enable_ansi_colors() enable_ansi_colors()
os.chdir(root_path) 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(): def eslint():
@ -49,5 +70,14 @@ def pylint():
quiet=True) 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__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())