Skip to content

Commit

Permalink
Add mypy CI job
Browse files Browse the repository at this point in the history
  • Loading branch information
djcopley committed Sep 1, 2024
1 parent 49c8cf3 commit 81b8b00
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
name: Ruff
on: [ push, pull_request ]
name: Lint
on:
push:
pull_request:
permissions:
contents: read

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.x"
- uses: pypa/hatch@install
- name: Run mypy
run: hatch run types:check
7 changes: 5 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ extra-dependencies = [
]

[tool.hatch.envs.types.scripts]
check = "mypy --install-types --non-interactive --explicit-package-bases {args:src/shelloracle tests}"
check = [
"mypy {args:src/shelloracle}",
"mypy --explicit-package-bases tests"
]

[tool.pytest.ini_options]
pythonpath = "src"
Expand All @@ -88,4 +91,4 @@ exclude_lines = [
]

[tool.ruff.lint.extend-per-file-ignores]
"tests/*" = ["INP001", "ARG"]
"tests/*" = ["INP001", "ARG"]
2 changes: 1 addition & 1 deletion src/shelloracle/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def user_configure_settings(provider: type[Provider]) -> dict[str, Any]:
for name, setting in get_settings(provider):
user_input = prompt(f"{name}: ", default=str(setting.default))
type_ = type(setting.default) if setting.default else str
value = type_(user_input)
value = type_(user_input) # type: ignore[operator]
settings[name] = value
return settings

Expand Down

0 comments on commit 81b8b00

Please sign in to comment.