Skip to content

Commit

Permalink
add lint session
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Nov 16, 2023
1 parent fe89730 commit 1f90fbb
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import nox

BLACK_VERSION = "black==22.3.0"
LINT_PATHS = ["docs", "google", "noxfile.py", "setup.py"]

# NOTE: Pin the version of grpcio-tools to 1.48.2 for compatibility with
# Protobuf 3.19.5. Please ensure that the minimum required version of
Expand All @@ -29,6 +30,7 @@

CURRENT_DIRECTORY = pathlib.Path(__file__).parent.absolute()


@nox.session(python="3.8")
def blacken(session):
"""Run black.
Expand Down Expand Up @@ -161,6 +163,7 @@ def test(session, library):
session.install("psutil")
system(session)


@nox.session(python=["3.6", "3.7", "3.8", "3.9", "3.10"])
def tests_local(session):
"""Run tests in this local repo."""
Expand Down Expand Up @@ -244,6 +247,7 @@ def docs(session):
os.path.join("docs", "_build", "html", ""),
)


@nox.session(python="3.10")
def docfx(session):
"""Build the docfx yaml files for this library."""
Expand Down Expand Up @@ -279,3 +283,19 @@ def docfx(session):
os.path.join("docs", ""),
os.path.join("docs", "_build", "html", ""),
)


@nox.session(python="3.9")
def lint(session):
"""Run linters.
Returns a failure if the linters find linting errors or sufficiently
serious code quality issues.
"""
session.install("flake8", BLACK_VERSION)
session.run(
"black",
"--check",
*LINT_PATHS,
)
session.run("flake8", "google", "tests")

0 comments on commit 1f90fbb

Please sign in to comment.