Skip to content

Commit

Permalink
run linters in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
cofiem committed Nov 16, 2024
1 parent c0dbf6d commit 1381153
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 33 deletions.
32 changes: 28 additions & 4 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,6 @@ jobs:
include-hidden-files: true
if-no-files-found: ignore

- name: Run mypy typing check
run: pipx run tox run --installpkg dist/*.whl -f py${PYTHON//./}-mypy


coverage:
name: Check test coverage
runs-on: ubuntu-latest
Expand Down Expand Up @@ -145,3 +141,31 @@ jobs:
name: html-report
path: htmlcov
if: ${{ failure() }}

lint:
name: Run linters
runs-on: ubuntu-latest
needs:
- build-package
- tests

steps:
- name: Download pre-built packages
uses: actions/download-artifact@v4
with:
name: Packages
path: dist

- name: Extract pre-built package
run: tar xf dist/*.tar.gz --strip-components=1

- name: Set up Python 3.13
uses: actions/setup-python@v5
with:
python-version: 3.13

- name: Lint style
run: pipx run tox run --installpkg dist/*.whl -f lint-style

- name: Lint docs
run: pipx run tox run --installpkg dist/*.whl -f lint-docs
29 changes: 2 additions & 27 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ lines-after-imports = 2
[tool.tox]
requires = ["tox>=4.19"]
env_list = [
"py3{9,10,11,12,13}-{tests,mypy}",
"py3{9,10,11,12,13}-tests",
"coverage-report",
"lint-style",
"lint-docs",
Expand Down Expand Up @@ -122,27 +122,6 @@ commands = [
["python", "-X", "dev", "-m", "coverage", "run", "-m", "pytest", "{posargs}"],
]

[tool.tox.env.py39-mypy]
commands = [
["mypy", "src"],
]
[tool.tox.env.py310-mypy]
commands = [
["mypy", "src"],
]
[tool.tox.env.py311-mypy]
commands = [
["mypy", "src"],
]
[tool.tox.env.py312-mypy]
commands = [
["mypy", "src"],
]
[tool.tox.env.py313-mypy]
commands = [
["mypy", "src"],
]

[tool.tox.env.coverage-report]
parallel_show_output = true
commands = [
Expand All @@ -154,13 +133,13 @@ commands = [
commands = [
["ruff", "check", "--fix", "--exit-non-zero-on-fix", "src", "tests"],
["ruff", "format", "--check", "--diff", "src", "tests"],
["mypy", "src"],
]

[tool.tox.env.lint-docs]
commands = [
["interrogate", "-vv", "--fail-under", "75", "src"],
["codespell", "--quiet-level", "0", "--summary", "--check-filenames", "--write-changes", "--skip", "*.pyc,*.png", "src", "tests"]
# ["codespell", "--help"]
]

[tool.mypy]
Expand All @@ -171,10 +150,6 @@ check_untyped_defs = true
no_implicit_optional = true
show_error_codes = true

[[tool.mypy.overrides]]
module = "tests.*"
ignore_errors = true

[tool.ruff]
line-length = 88
show-fixes = true
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ google-auth-oauthlib~=1.2.1
platformdirs~=4.3.6

# compatibility
# (version spec is 'greater than' instead of 'specific version' due to different versions used by dependencies)
importlib_resources>=5
importlib_metadata>=6
typing-extensions>=4
3 changes: 1 addition & 2 deletions tests/test_app_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

import pytest

from tests.helpers import normalise_path

from helpers import normalise_path
from screenshot_ocr import utils
from screenshot_ocr.app_paths import DefaultPaths

Expand Down

0 comments on commit 1381153

Please sign in to comment.