Skip to content

Commit

Permalink
build: fix ruff config
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W committed Jun 30, 2024
1 parent 3f7dea8 commit f077221
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 61 deletions.
106 changes: 46 additions & 60 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,46 @@
name = "cz_conventional_commits"
version = "0.7.0"
tag_format = "v$version"
version_files = [
"pyproject.toml:^version"
]
version_files = ["pyproject.toml:^version"]


[tool.ruff]
line-length = 88
ignore = [
"E501",
"D1",
"D415",
]

[tool.ruff.isort]
[tool.ruff.lint]
ignore = ["E501", "D1", "D415"]

[tool.ruff.lint.isort]
known-first-party = ["tests"]

[tool.ruff.pydocstyle]
[tool.ruff.lint.pydocstyle]
convention = "google"


[tool.mypy]
files = [
"mail_handler",
"tests"
]
files = ["mail_handler", "tests"]
ignore_missing_imports = true
follow_imports = "silent"
warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
[[tool.mypy.overrides]]
module = ["mail_handler.*"]
# Ensure full coverage
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
# disallow_untyped_decorators = true
# Restrict dynamic typing
disallow_any_generics = true
disallow_subclassing_any = true
warn_return_any = true

[[tool.mypy.overrides]]
module = ["tests.*"]
disallow_untyped_defs = false
disallow_untyped_decorators = false

[[tool.mypy.overrides]]
module = ["mail_handler.*"]
# Ensure full coverage
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
# disallow_untyped_decorators = true
# Restrict dynamic typing
disallow_any_generics = true
disallow_subclassing_any = true
warn_return_any = true

[[tool.mypy.overrides]]
module = ["tests.*"]
disallow_untyped_defs = false
disallow_untyped_decorators = false


[tool.pytest.ini_options]
Expand All @@ -64,36 +58,30 @@ norecursedirs = [
"*.egg",
"venv",
"env",
"virtualenv"
"virtualenv",
]


[tool.coverage]
[tool.coverage.report]
show_missing = true
exclude_lines = [
# Have to re-enable the standard pragma
'pragma: no cover',

# Don't complain about missing debug-only code:
'def __repr__',
'if self\.debug',

# Don't complain if tests don't hit defensive assertion code:
'raise AssertionError',
'raise NotImplementedError',

# Don't complain if non-runnable code isn't run:
'if 0:',
'if __name__ == .__main__.:'
]
omit = [
'env/*',
'venv/*',
'*/virtualenv/*',
'*/virtualenvs/*',
'*/tests/*'
]
[tool.coverage.report]
show_missing = true
exclude_lines = [
# Have to re-enable the standard pragma
'pragma: no cover',

# Don't complain about missing debug-only code:
'def __repr__',
'if self\.debug',

# Don't complain if tests don't hit defensive assertion code:
'raise AssertionError',
'raise NotImplementedError',

# Don't complain if non-runnable code isn't run:
'if 0:',
'if __name__ == .__main__.:',
]
omit = ['env/*', 'venv/*', '*/virtualenv/*', '*/virtualenvs/*', '*/tests/*']


[tool.poetry]
Expand All @@ -103,9 +91,7 @@ description = "Mail toolkit for PyCon Taiwan"
authors = ["Lee-W <[email protected]>"]
license = "MIT"
readme = "docs/README.md"
packages = [
{"include" = "mail_handler"}
]
packages = [{ "include" = "mail_handler" }]

[tool.poetry.scripts]
render_mail = "mail_handler.render_mail:main"
Expand All @@ -124,7 +110,7 @@ invoke = "^2.2.0"
pytest = "^8.0.0"
pytest-cov = "^5.0.0"
pytest-mock = "^3.0.0"
coverage = {extras = ["toml"], version = "^7.5.4"}
coverage = { extras = ["toml"], version = "^7.5.4" }
tox = "^3.15.1"
# style
ruff = "^0.5.0"
Expand Down
2 changes: 1 addition & 1 deletion tasks/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@task
def ruff(ctx: Context) -> None:
"""Check style through ruff"""
ctx.run(f"{VENV_PREFIX} ruff {COMMON_TARGETS_AS_STR}")
ctx.run(f"{VENV_PREFIX} ruff check {COMMON_TARGETS_AS_STR}")


@task
Expand Down

0 comments on commit f077221

Please sign in to comment.