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:
parent
1d26da6a47
commit
ff4b7b0921
2 changed files with 33 additions and 7 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
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()
|
eslint()
|
||||||
pylint()
|
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())
|
||||||
|
|
Loading…
Reference in a new issue