Skip to content

Commit

Permalink
Combine all config into pyproject.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
Snuffy2 committed Dec 8, 2024
1 parent 1885fd7 commit 56c4f03
Show file tree
Hide file tree
Showing 6 changed files with 125 additions and 146 deletions.
3 changes: 0 additions & 3 deletions .coveragerc

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
python-version:
- "3.12"
- "3.13"

steps:
- name: 📥 Checkout the repository
Expand Down
50 changes: 0 additions & 50 deletions pylintrc

This file was deleted.

148 changes: 124 additions & 24 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
[tool.black]
target-version = ["py38"]
target-version = ["py311", "py312", "py313"]
exclude = 'generated'

[tool.coverage.report]
show_missing = true
fail_under = 80

[tool.flake8]
exclude = [
".venv",
".git",
".tox",
"docs",
"venv",
"bin",
"lib",
"deps",
"build",
]
max-line-length = 88
ignore = [
"E501", # line too long
"W503", # Line break occurred before a binary operator
"E203", # Whitespace before ':'
"D202", # No blank lines allowed after function docstring
"W504", # Line break after binary operator
]

[tool.isort]
# https://github.com/PyCQA/isort/wiki/isort-Settings
profile = "black"
Expand All @@ -15,25 +40,39 @@ forced_separate = [
"tests",
]
combine_as_imports = true
multi_line_output = 3
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
line_length = 88

[tool.pylint.MASTER]
ignore = [
"tests",
]
[tool.mypy]
python_version = "3.13"
show_error_codes = true
ignore_errors = true
follow_imports = "silent"
ignore_missing_imports = true
warn_incomplete_stub = true
warn_redundant_casts = true
warn_unused_configs = true

[tool.pylint]
ignore = ["tests"]
jobs = 2
persistent = false
# Use a conservative default here; 2 should speed up most setups and not hurt
# any too bad. Override on command line as appropriate.
# Disabled for now: https://github.com/PyCQA/pylint/issues/3584
#jobs = 2
load-plugins = [
"pylint_strict_informational",
]
persistent = false
extension-pkg-whitelist = [
"ciso8601",
"cv2",
]

[tool.pylint.BASIC]
[tool.pylint.basic]
good-names = [
"_",
"ev",
Expand All @@ -46,6 +85,23 @@ good-names = [
"Run",
"T",
]
max-attributes = 15
argument-naming-style = "snake_case"
attr-naming-style = "snake_case"

[tool.pylint.exceptions]
overgeneral-exceptions = [
"BaseException",
"Exception",
"HomeAssistantError",
]

[tool.pylint.format]
expected-line-ending-format = "LF"

[tool.pylint."messages control"]
# Disable specific messages for the reasons documented in the original pylintrc.


[tool.pylint."MESSAGES CONTROL"]
# Reasons disabled:
Expand All @@ -62,25 +118,29 @@ good-names = [
# too-many-ancestors - it's too strict.
# wrong-import-order - isort guards this
disable = [
"format",
"abstract-class-little-used",
"abstract-method",
"broad-except",
"cyclic-import",
"duplicate-code",
"fixme",
"format",
"import-outside-toplevel",
"inconsistent-return-statements",
"locally-disabled",
"not-context-manager",
"too-few-public-methods",
"too-many-ancestors",
"too-many-arguments",
"too-many-boolean-expressions",
"too-many-branches",
"too-many-instance-attributes",
"too-many-lines",
"too-many-locals",
"too-many-public-methods",
"too-many-return-statements",
"too-many-statements",
"too-many-boolean-expressions",
"unexpected-keyword-arg",
"unused-argument",
"wrong-import-order",
]
Expand All @@ -89,23 +149,14 @@ enable = [
"use-symbolic-message-instead",
]

[tool.pylint.REPORTS]
score = false

[tool.pylint.TYPECHECK]
ignored-classes = [
"_CountingAttr", # for attrs
]
[tool.pylint.refactoring]
max-nested-blocks = 8

[tool.pylint.FORMAT]
expected-line-ending-format = "LF"
[tool.pylint.reports]
score = false

[tool.pylint.EXCEPTIONS]
overgeneral-exceptions = [
"BaseException",
"Exception",
"HomeAssistantError",
]
[tool.pylint.typecheck]
ignored-classes = ["_CountingAttr"]

[tool.pytest.ini_options]
testpaths = [
Expand All @@ -115,3 +166,52 @@ norecursedirs = [
".git",
"testing_config",
]
asyncio_mode = "auto"
asyncio_default_fixture_loop_scope = "function"

[tool.tox]
skipsdist = true
envlist = ["py311", "py312", "py313", "lint", "mypy"]
skip_missing_interpreters = true

[tool.tox.gh-actions]
python = {
"3.11" = ["py311"],
"3.12" = ["py312"],
"3.13" = ["py313", "lint", "mypy"]
}

[tool.tox.testenv]
description = "Run tests with pytest"
commands = [
"pytest -v --asyncio-mode=auto --timeout=30 --cov=custom_components/keymaster --cov-report=xml {posargs}",
]
deps = [
"-rrequirements_test.txt",
]

[tool.tox.testenv.lint]
description = "Lint code using black, flake8, pylint, and pydocstyle"
basepython = "python3"
ignore_errors = true
commands = [
"black --check custom_components/",
"black --check tests/",
"flake8 custom_components/keymaster",
"pylint custom_components/keymaster",
"pydocstyle custom_components/keymaster tests",
]
deps = [
"-rrequirements_test.txt",
]

[tool.tox.testenv.mypy]
description = "Run mypy for type-checking"
basepython = "python3"
ignore_errors = true
commands = [
"mypy custom_components/keymaster",
]
deps = [
"-rrequirements_test.txt",
]
32 changes: 0 additions & 32 deletions setup.cfg

This file was deleted.

36 changes: 0 additions & 36 deletions tox.ini

This file was deleted.

0 comments on commit 56c4f03

Please sign in to comment.