Skip to content

Commit

Permalink
Add linting configs
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdaemon committed Apr 3, 2024
1 parent a24ec9c commit 79e9f3c
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,93 @@ dependencies = ["coverage[toml]>=6.5", "pytest>=6.0"]
[[tool.hatch.envs.testall.matrix]]
python = ["3.8", "3.9", "3.10", "3.11", "3.12"]

[tool.isort]
profile = "black"
line_length = 80
include_trailing_comma = true
use_parentheses = true
known_first_party = ["polymatch"]
float_to_top = true

[tool.black]
line-length = 80
target-version = ["py38"]
include = '\.pyi?$'

[tool.ruff]
line-length = 80
target-version = 'py38'

[tool.ruff.format]
docstring-code-format = true
line-ending = "lf"
skip-magic-trailing-comma = true

[tool.ruff.lint]
ignore-init-module-imports = false
extend-safe-fixes = ["EM101", 'EM102', "TCH001", "SIM117", "SIM108", "ANN201"]
ignore = [
"D",
"TRY003", # TODO(aspen): Switch to custom exceptions
"ANN101", # Due to be deprecated in ruff
"ANN102", # Due to be deprecated in ruff
"COM812", # Conflicts with formatter
"ISC001", # Conflicts with formatter
"EXE002", # pre-commit does it better, works with SMB shares
"FA100",
]
select = ["ALL"]

[tool.ruff.lint.per-file-ignores]
"tests/*.py" = [
"PLR2004", # Allow "magic values" in tests -aspen
"S101", # Allow asserts in tests
"SIM201", # We need to test weird comparison operators
"SIM202", # We need to test weird comparison operstors
"SIM300", # We need to test both forward and reverse comparisons
"FBT001", # Boolean paramters are fine for test cases
]

[tool.ruff.lint.pycodestyle]
max-line-length = 100

[tool.ruff.lint.isort]
split-on-trailing-comma = false

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

[tool.mypy]
namespace_packages = true
python_version = "3.8"
warn_unused_configs = true
strict = true
strict_optional = true
ignore_missing_imports = true
check_untyped_defs = true
show_error_codes = true
warn_unused_ignores = true
no_implicit_reexport = true
warn_redundant_casts = true
strict_equality = true
disallow_any_generics = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_untyped_decorators = true
extra_checks = true
warn_unreachable = true
warn_return_any = true
warn_no_return = true
enable_error_code = [
"redundant-self",
"redundant-expr",
"possibly-undefined",
"truthy-bool",
"truthy-iterable",
"ignore-without-code",
"unused-awaitable",
]

[tool.pytest.ini_options]
minversion = "6.0"
addopts = "--doctest-modules"
Expand Down

0 comments on commit 79e9f3c

Please sign in to comment.