Debian Codegraph @

ansible_collections/community/general/ruff.toml

raw
1 # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
2 # SPDX-License-Identifier: GPL-3.0-or-later
3 # SPDX-FileCopyrightText: 2025 Felix Fontein <[email protected]>
4
5 line-length = 120
6
7 [lint]
8 # https://docs.astral.sh/ruff/rules/
9
10 select = ["A", "B", "E", "F", "FA", "FLY", "UP", "SIM", "I", "RUF022"]
11 ignore = [
12 # Better keep ignored (for now)
13 "F811", # Redefinition of unused `xxx` (happens a lot for fixtures in unit tests)
14 "E402", # Module level import not at top of file
15 "E741", # Ambiguous variable name
16 "UP012", # unnecessary-encode-utf8
17 "UP015", # Unnecessary mode argument
18 "SIM105", # suppressible-exception
19 "SIM108", # if-else-block-instead-of-if-exp
20 # To fix later:
21 "B905", # zip-without-explicit-strict - needs Python 3.10+
22 "UP045", # Use `X | None` for type annotations - needs Python 3.10+
23 # To fix:
24 "B026", # star-arg-unpacking-after-keyword-arg
25 "SIM102", # collapsible-if
26 "SIM114", # if-with-same-arms
27 "SIM115", # open-file-with-context-handler
28 "SIM116", # if-else-block-instead-of-dict-lookup
29 "SIM117", # multiple-with-statements
30 "SIM118", # in-dict-keys
31 "SIM210", # if-expr-with-true-false
32 "SIM401", # if-else-block-instead-of-dict-get
33 "A001", # builtin-variable-shadowing
34 "A002", # builtin-argument-shadowing
35 "A004", # builtin-import-shadowing
36 ]
37
38 # Allow fix for all enabled rules (when `--fix`) is provided.
39 fixable = ["ALL"]
40 unfixable = []
41
42 # Allow unused variables when underscore-prefixed or starting with dummy
43 dummy-variable-rgx = "^(_|dummy).*$"
44
45 [lint.pycodestyle]
46 max-line-length = 160
47
48 [format]
49 # https://docs.astral.sh/ruff/formatter/#configuration
50
51 # Like Black, use double quotes for strings.
52 quote-style = "double"
53
54 # Like Black, indent with spaces, rather than tabs.
55 indent-style = "space"
56
57 # Like Black, respect magic trailing commas.
58 skip-magic-trailing-comma = false
59
60 line-ending = "lf"
61
62 # Disable auto-formatting of code examples in docstrings. Markdown,
63 # reStructuredText code/literal blocks and doctests are all supported.
64 docstring-code-format = false
65
66 [lint.isort]
67 known-first-party = [
68 "ansible_collections.community.general",
69 ]
70 known-third-party = [
71 "ansible_collections.community.internal_test_tools",
72 ]