From 0f3c38acfcd3de773e674dc5882aab308d722550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Sat, 2 Dec 2023 21:31:19 -0800 Subject: [PATCH] Use pre-commit with CI for linting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- .github/workflows/tests.yml | 20 ++------------------ noxfile.py | 13 ++----------- 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index cf3b95ad21..d813a2a110 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -22,22 +22,6 @@ env: default-python: "3.12" jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ env.default-python }} - uses: actions/setup-python@v4 - with: - python-version: ${{ env.default-python }} - - name: Upgrade pip, Install nox - run: | - python -m pip install --upgrade pip - python -m pip install nox - - name: Lint - run: | - nox --error-on-missing-interpreters --non-interactive --session lint - tests: runs-on: ${{ matrix.os }} strategy: @@ -82,7 +66,7 @@ jobs: pypi-publish: name: Publish pipx to PyPI on release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - needs: [lint, tests] + needs: [tests] runs-on: ubuntu-latest steps: - name: Checkout ${{ github.ref }} @@ -107,7 +91,7 @@ jobs: build-zipapp: name: Build zipapp if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - needs: [lint, tests] + needs: [tests] runs-on: ubuntu-latest steps: - name: Checkout ${{ github.ref }} diff --git a/noxfile.py b/noxfile.py index ab2d89e742..dd39101262 100644 --- a/noxfile.py +++ b/noxfile.py @@ -146,17 +146,8 @@ def cover(session): @nox.session(python=PYTHON_DEFAULT_VERSION) def lint(session): session.run("python", "-m", "pip", "install", "--upgrade", "pip") - session.install(*LINT_DEPENDENCIES) - files = [str(Path("src") / "pipx"), "tests", "scripts"] + [str(p) for p in Path(".").glob("*.py")] - session.run("ruff", *files) - session.run( - "mypy", - "--strict-equality", - "--no-implicit-optional", - "--warn-unused-ignores", - "--check-untyped-defs", - *files, - ) + session.run("python", "-m", "pip", "install", "pre-commit") + session.run("pre-commit", "run", "--all-files") @nox.session(python=PYTHON_ALL_VERSIONS)