Skip to content

Commit dcd688f

Browse files
committed
configure the linters and formatters
1 parent 86f82f9 commit dcd688f

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

pyproject.toml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,84 @@ pytest = ">=7.1.0"
6767
pytest-cov = ">=5.0.0"
6868
typer = "*"
6969

70+
[tool.codespell]
71+
skip = ".git,.mypy_cache,.nox,.vscode,__pycache__,pyproject.toml,poetry.lock"
72+
builtin = "clear,rare,informal,usage,code,names"
73+
ignore-words-list = "jupyter,iff" # prevent jupyter -> jupiter, iff -> if
74+
check-filenames = true
75+
uri-ignore-words-list = "*" # prevent spelling correction in URL-like values.
76+
77+
[tool.mypy]
78+
files = ['*.py', 'looptrace-loci-vis/*.py', 'tests/*.py']
79+
plugins = ["pydantic.mypy"]
80+
warn_redundant_casts = true
81+
warn_unused_ignores = true
82+
warn_return_any = true
83+
warn_unreachable = true
84+
enable_error_code = ["ignore-without-code"]
85+
86+
[[tool.mypy.overrides]]
87+
module = "looptrace_loci_vis.*"
88+
disallow_untyped_defs = true
89+
disallow_untyped_calls = true
90+
disallow_incomplete_defs = true
91+
check_untyped_defs = true
92+
disallow_any_unimported = true
93+
disallow_any_explicit = true
94+
disallow_any_generics = true
95+
disallow_subclassing_any = true
96+
implicit_optional = false
97+
strict_optional = true
98+
99+
[tool.ruff]
100+
# Black uses line-length = 88, but allows exceptions when breaking the line
101+
# would lead to other rule violations. Use 100 as a maximum hard limit:
102+
line-length = 100
103+
target-version = "py310"
104+
105+
[tool.ruff.lint]
106+
select = ["ALL"]
107+
ignore = [
108+
# Missing members
109+
"ANN10", # Deprecated: Missing type annotation for self/cls in (class)method
110+
"D105", # Missing docstring in magic method
111+
"ANN204", # Missing return type annotation for special method
112+
113+
# Opinionated syntax
114+
"D203", # Ignore this to instead opt for class body or docstring to possibly start right away under class.
115+
"D213", # Ignore this to instead opt for summary part of docstring to be on first physical line.
116+
"TRY003", # Avoid specifying long messages outside the exception class
117+
"C408", # Unnecessary `dict` call (rewrite as a literal)
118+
"EM", # Exception must not use a (f-)string literal, assign to variable first
119+
"FIX002", # Line contains TODO, consider resolving the issue
120+
"D400", # First line should end with a period
121+
"D415", # First line should end with a period, question mark, or exclamation point
122+
"N818", # Exception should be named with an Error suffix
123+
124+
# Imports and type annotations
125+
"FA100", # Missing `from __future__ import annotations`, but uses `typing.*`
126+
"TCH002", # Move third-party import `...` into a type-checking block
127+
"TCH003", # Move standard library import `...` into a type-checking block
128+
"UP007", # Use `X | Y` for type annotations
129+
130+
# Ruff recommends avoiding these checks when using `ruff format`. Since
131+
# `ruff format` is a drop-in replacement for `black`, we avoid the same
132+
# checks here (https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
133+
# has more details):
134+
"W191", # tab-indentation
135+
"E111", # indentation-with-invalid-multiple
136+
"E114", # indentation-with-invalid-multiple-comment
137+
"E117", # over-indented
138+
"D206", # indent-with-spaces
139+
"D300", # triple-single-quotes
140+
"Q000", # bad-quotes-inline-string
141+
"Q001", # bad-quotes-multiline-string
142+
"Q002", # bad-quotes-docstring
143+
"Q003", # avoidable-escaped-quote
144+
"COM812", # missing-trailing-comma
145+
"COM819", # prohibited-trailing-comma
146+
"ISC001", # single-line-implicit-string-concatenation
147+
"ISC002", # multi-line-implicit-string-concatenation
148+
"E501", # line-too-long
149+
]
150+

0 commit comments

Comments
 (0)