File size: 2,458 Bytes
6ae6e49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1602469
6ae6e49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# Copied from https://github.com/rerun-io/rerun_template

[tool.ruff]
# https://beta.ruff.rs/docs/configuration/

target-version = "py38"

# Enable unsafe fixes to allow ruff to apply fixes that may change the behavior of the code.
# This is needed because otherwise ruff will not be able to trim whitespaces in (codegened) docstrings.
unsafe-fixes = true

# Allow preview lints to be enabled (like `PLW1514` to force `encoding` on open).
preview = true
# But we only want to opt-in to certain preview rules!
lint.explicit-preview-rules = true

extend-exclude = [
    # Automatically generated test artifacts
    "venv/",
    "target/",
]

lint.ignore = [
    # Missing docstring in public function/class
    "D1",

    # No blank lines allowed after function docstring.
    "D202",

    # npydocstyle: http://www.pydocstyle.org/en/stable/error_codes.html
    # numpy convention with a few additional lints
    "D107",
    "D203",
    "D212",
    "D401",
    "D402",
    "D415",
    "D416",

    # Ruff can't fix this error on its own (yet)
    # Having ruff check this causes errors that prevent the code-formatting process from completing.
    "E501",

    # allow relative imports
    "TID252",

    "UP007", # We need this, or `ruff format` will convert `Union[X, Y]` to `X | Y` which break on Python 3.8
]

line-length = 120
lint.select = [
    "D",       # pydocstyle codes https://www.pydocstyle.org/en/latest/error_codes.html
    "E",       # pycodestyle error codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
    "F",       # Flake8 error codes https://flake8.pycqa.org/en/latest/user/error-codes.html
    "I",       # Isort
    "TID",     # flake8-tidy-imports
    "W",       # pycodestyle warning codes: https://pycodestyle.pycqa.org/en/latest/intro.html#error-codes
    "UP",      # pyupgrade (ensures idomatic code for supported python version)
    "PLW1514", # Force setting `encoding` for open calls. This is in order to prevent issues when opening utf8 files on windows where the default encoding may depend on the active locale. https://docs.astral.sh/ruff/rules/unspecified-encoding/
]

lint.unfixable = [
    "PLW1514", # Automatic fix for `encoding` doesn't do what we want - it queries the locale for the preferred encoding which is exactly what we want to avoid.
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]

[tool.ruff.lint.isort]
required-imports = ["from __future__ import annotations"]