From c55976594240d18bcd86ad61bf5cf31ef954e652 Mon Sep 17 00:00:00 2001 From: Vladyslav Fedoriuk Date: Thu, 3 Aug 2023 10:09:40 +0200 Subject: [PATCH] Fix mypy pre-commit and GitHub action --- .github/workflows/app.yaml | 2 +- .pre-commit-config.yaml | 4 +++- app/scraper/tests/test_client.py | 5 +---- app/scraper/tests/test_mapper.py | 4 +--- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/app.yaml b/.github/workflows/app.yaml index 5ef6d2d..21896e2 100644 --- a/.github/workflows/app.yaml +++ b/.github/workflows/app.yaml @@ -25,7 +25,7 @@ jobs: python -m ruff check --verbose --format=github . - name: Lint with mypy run: | - python -m mypy --show-error-codes --pretty --show-column-numbers --show-error-context $(git ls-files '*.py') + python -m mypy --show-error-codes --pretty --show-column-numbers --show-error-context . - name: Lint with black run: | python -m black --check --verbose . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ee6d159..0efa2d1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,10 +24,12 @@ repos: hooks: - id: mypy name: mypy - entry: mypy + entry: | + python -m mypy . types: [ python ] language: system require_serial: true + pass_filenames: false - repo: https://github.com/ambv/black rev: 23.7.0 hooks: diff --git a/app/scraper/tests/test_client.py b/app/scraper/tests/test_client.py index 99b3ff8..2f1648c 100644 --- a/app/scraper/tests/test_client.py +++ b/app/scraper/tests/test_client.py @@ -92,10 +92,7 @@ def test_source_graph_repo_data(source_graph_matched_repos_data: Json[Any]) -> N source_graph_matched_repos_data ) assert repos_parsed == HasLen(4) - assert all( - repo == IsInstance[SourceGraphRepoData] # type: ignore[type-var] - for repo in repos_parsed - ) + assert all(repo == IsInstance[SourceGraphRepoData] for repo in repos_parsed) assert all( repo.repo_id == repo_data["repositoryID"] for repo, repo_data in zip( diff --git a/app/scraper/tests/test_mapper.py b/app/scraper/tests/test_mapper.py index 8e800da..efac398 100644 --- a/app/scraper/tests/test_mapper.py +++ b/app/scraper/tests/test_mapper.py @@ -23,7 +23,5 @@ async def test_create_repos_from_source_graph_repos_data( test_db_session, source_graph_repo_data ) assert repos == IsList(length=5) - assert all( - repo == IsInstance[database.Repo] for repo in repos # type: ignore[type-var] - ) + assert all(repo == IsInstance[database.Repo] for repo in repos) assert all(repo.id is not None for repo in repos)