mirror of
https://github.com/elastic/eland.git
synced 2025-07-11 00:02:14 +08:00
parent
bad37971cb
commit
6759b1db70
21
noxfile.py
21
noxfile.py
@ -16,7 +16,6 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import subprocess
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import nox
|
import nox
|
||||||
@ -78,21 +77,17 @@ def lint(session):
|
|||||||
session.run("flake8", "--extend-ignore=E203,E402,E501,E704,E712", *SOURCE_FILES)
|
session.run("flake8", "--extend-ignore=E203,E402,E501,E704,E712", *SOURCE_FILES)
|
||||||
|
|
||||||
# TODO: When all files are typed we can change this to .run("mypy", "--strict", "eland/")
|
# TODO: When all files are typed we can change this to .run("mypy", "--strict", "eland/")
|
||||||
session.log("mypy --show-error-codes --strict eland/")
|
stdout = session.run(
|
||||||
for typed_file in TYPED_FILES:
|
"mypy",
|
||||||
if not os.path.isfile(typed_file):
|
"--show-error-codes",
|
||||||
session.error(f"The file {typed_file!r} couldn't be found")
|
"--strict",
|
||||||
process = subprocess.run(
|
*TYPED_FILES,
|
||||||
["mypy", "--show-error-codes", "--strict", typed_file],
|
success_codes=(0, 1),
|
||||||
env=session.env,
|
silent=True,
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.STDOUT,
|
|
||||||
)
|
)
|
||||||
# Ensure that mypy itself ran successfully
|
|
||||||
assert process.returncode in (0, 1)
|
|
||||||
|
|
||||||
errors = []
|
errors = []
|
||||||
for line in process.stdout.decode().split("\n"):
|
for line in stdout.splitlines():
|
||||||
filepath = line.partition(":")[0]
|
filepath = line.partition(":")[0]
|
||||||
if filepath in TYPED_FILES:
|
if filepath in TYPED_FILES:
|
||||||
errors.append(line)
|
errors.append(line)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user