Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add mypy type checking #14

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -5,5 +5,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: chartboost/ruff-action@v1
- uses: psf/black@stable
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install tox
run: pip install tox
- name: Lint with ruff, black and mypy
run: tox -e lint
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Python
on: [push, pull_request]
on: [pull_request]
jobs:
Pytest:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
5 changes: 4 additions & 1 deletion git_hg_sync/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import argparse
import sys
import logging
from pathlib import Path

import sentry_sdk
@@ -45,7 +46,9 @@ def get_queue(config):
)


def start_app(config, logger, *, one_shot=False):
def start_app(
config: Config, logger: logging.Logger, *, one_shot: bool = False
) -> None:
pulse_config = config.pulse
connection = get_connection(pulse_config)

8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -11,3 +11,11 @@ dependencies = ['kombu', 'mozillapulse', 'GitPython', 'mozlog', "pydantic", "sen

[tool.ruff]
line-length = 100

[[tool.mypy.overrides]]
module = [
'kombu.*',
'mozlog'
]

ignore_missing_imports = true
3 changes: 2 additions & 1 deletion tests/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from pathlib import Path
import subprocess


def hg_export_tip(repo_path: str):
def hg_export_tip(repo_path: Path):
process = subprocess.run(
["hg", "export", "tip"],
cwd=repo_path,
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -19,6 +19,10 @@ description = lint source code
deps =
ruff
black
mypy
pytest # dev dependency
ignore_errors = true # Run commands even if an earlier command failed
commands =
ruff check git_hg_sync/ tests/
black --check git_hg_sync tests
mypy git_hg_sync/ tests/
Loading
Oops, something went wrong.