Skip to content

Commit a7182d0

Browse files
committed
chore: Add formatting rules
1 parent 6c0971a commit a7182d0

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

pyproject.toml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,61 @@ packages = ["musicbrainzngs"]
3333

3434
[tool.setuptools.dynamic]
3535
version = { attr = "musicbrainzngs.musicbrainz._version" }
36+
37+
[tool.ruff]
38+
# Target non-EOL releases at minimum - https://devguide.python.org/versions/
39+
target-version = "py310"
40+
# Soft 80 and hard break at 120
41+
line-length = 120
42+
# Translations
43+
builtins = ["_"]
44+
45+
[tool.ruff.lint.flake8-quotes]
46+
inline-quotes = "double"
47+
docstring-quotes = "double"
48+
49+
[tool.ruff.format]
50+
quote-style = "double"
51+
indent-style = "tab"
52+
53+
# https://docs.astral.sh/ruff/rules/
54+
[tool.ruff.lint]
55+
select = ['ALL']
56+
ignore = [
57+
'COM812', # missing-trailing-comma - Using the formatter makes this rule redundant
58+
#'C901', # complex-structure - We'll ignore functions being too complex for now - https://github.com/microsoft/pyright/issues/10839
59+
'Q003', # avoidable-escaped-quote - It's not that important, we just use escapes, keeping the quotes consistent
60+
'W191', # tab-indentation - We use tabs for indents, disabling this PEP 8 recommendation
61+
'D206', # indent-with-spaces - ^
62+
'D100', # undocumented-public-module - TODO(Martin): We currently don't even have typing fully implemented, let's maybe care about undocumented functions/classes later
63+
'D101', # undocumented-public-class - ^
64+
'D102', # public-method - ^
65+
'D103', # undocumented-public-function - ^
66+
'D104', # undocumented-public-package - ^
67+
#'D105', # undocumented-magic-method - ^ < This one is a bit more severe though
68+
'D106', # undocumented-public-nested-class - ^
69+
'D107', # undocumented-public-init - ^
70+
'D400', # ends-in-period - We do not care if docstrings end with a period
71+
'D415', # ends-in-punctuation - ^
72+
'D203', # incorrect-blank-line-before-class - Clashes with D211
73+
#'D211', # no-blank-line-before-class - Clashes with D203
74+
#'D212', # multi-line-summary-first-line - Clashes with D213
75+
'D213', # multi-line-summary-second-line - Clashes with D212
76+
'D401', # non-imperative-mood - Wants docstrings in imperative language but it's really not foolproof, disable
77+
#'E501', # line-too-long - TODO(Martin) - We want this enabled, but only after the rest of issues is gone
78+
'EM101', # raw-string-in-exception - We do not care about .format in exceptions, readability is not *our* problem, traceback should be colorized to avoid this instead
79+
'EM102', # f-string-in-exception - ^
80+
'EM103', # dot-format-in-exception - ^
81+
#'S311', # suspicious-non-cryptographic-random-usage - We aren't using random for anything important
82+
'ERA001', # commented-out-code - Tests for commented out code, but it has way too many false positives, so disable
83+
'FBT001', # boolean-type-hint-positional-argument - Allow positional booleans in functions, it's not really that much of an issue
84+
'FBT002', # boolean-default-value-positional-argument - ^
85+
'FBT003', # boolean-positional-value-in-call - ^
86+
#'G004', # logging-f-string - Ignore this, we lose some efficiency but I suppose nobody wants to do a total overhaul of the logging system for next to no gains
87+
#'LOG015', # root-logger-call - We are not a library and have customized the logger
88+
#'TD003', # missing-todo-link - We're fine not linking existing issues in TODOs, it's fine to have them noted in code only
89+
#'PLR0911', # too-many-return-statements - We'll ignore functions having too many return statements
90+
#'PLR0912', # too-many-branches - We'll ignore functions having too many branches for now
91+
#'PLR0913', # too-many-arguments - We'll ignore functions taking too many arguments
92+
#'PLR0915', # too-many-statements - We'll ignore functions having too many statements
93+
]

0 commit comments

Comments
 (0)