[tool.ruff] target-version = "py313" [tool.ruff.lint] extend-select = [ "ARG", "A", "ANN", "B", "BLE", "C4", "COM", "D", "E", "EM", "EXE", "F", "FA", "FBT", "G", "I", "ICN", "INP", "INT", "ISC", "N", "NPY", "PERF", "PGH", "PTH", "PIE", # "PL", "PT", "Q", "RET", "RSE", "RUF", "S", # "SLF", "SIM", "T", "TCH", "TID", "UP", "W", ] # Each rule exclusion should be explained here. # By default, we think it is better to select groups of rules (above), and exclude # specific problematic rules, instead of selecting specific rules. By doing so, in case # the ruff rules groups change, this requires us to check and handle the new rules or # changes, making sure we stay up to date and keep the best practices. # ANN003: # Would mostly apply to args/kwargs that are passed to methods from dependencies, for # which the signature can change depending on the version. This would either be too # difficult to comply and/or would add a lot of noqa exceptions. ANN002 is used as it # adds very few "noqa" exceptions, but ANN003 would add too much complexity. # ANN101 and ANN102: # Yields errors for `self` in methods from classes, which is unecessary. # The existence of these rules is currently questioned, they are likely to be removed. # https://github.com/astral-sh/ruff/issues/4396 # B905 # The `strict` keyword argument for the `zip` built-in method appeared with Python # 3.10. As we support previous versions, we cannot comply (yet) with this rule. The # exclusion should be removed when dropping support for Python 3.9. # D107 # We document classes at the class level (D101). This documentation should cover the # way classes are initialized. So we do not document `__init__` methods. # D203 # "one-blank-line-before-class", incompatible with D211 (blank-line-before-class). # We follow PEP 257 and other conventions by preferring D211 over D203. # D212 # "multi-line-summary-first-line", incompatible with D213 # (multi-line-summary-second-line). # We follow PEP 257, which recommend to set put the summary line on the second line # after the blank line of the opening quotes. # FBT001 and FBT002 # Refactoring all the methods to make boolean arguments keyword only would add # complexity and could break code of users. It's ok to have booleans as positional # arguments with default values. For code redability though, we enable FB003. # COM812: # Yields errors for one-line portions without comma. Trailing commas are automatically # set with ruff format anyway. This exclusion could be removed when this behavior is # fixed in ruff. # UP038 # Recommends to | type union with `isinstance`, which is only supported since Python # 3.10. The exclusion should be removed when dropping support for Python 3.9. # (ISC001) # May cause conflicts when used with the ruff formatter. They recommend to disable it. # We leave it enabled but keep this in mind. ignore = [ "ANN003", "ANN101", "ANN102", "B905", "COM812", "D107", "D203", "D212", "FBT001", "FBT002", "UP038", ]