|
| 1 | +# Ruff configuration file |
| 2 | +# For rules reference, see https://docs.astral.sh/ruff/rules/ |
| 3 | +target-version = "py310" |
| 4 | +preview = true |
| 5 | +line-length = 100 |
| 6 | + |
| 7 | +select = [ |
| 8 | + # For rules reference, see https://docs.astral.sh/ruff/rules/ |
| 9 | + "A", # flake8-builtins |
| 10 | + "ANN", # flake8-annotations |
| 11 | + "ARG", # flake8-unused-arguments |
| 12 | + "ASYNC", # flake8-async |
| 13 | + "B", # flake8-bugbear |
| 14 | + "FBT", # flake8-boolean-trap |
| 15 | + "BLE", # Blind except |
| 16 | + "C4", # flake8-comprehensions |
| 17 | + "C90", # mccabe (complexity) |
| 18 | + "COM", # flake8-commas |
| 19 | + "CPY", # missing copyright notice |
| 20 | + "D", # pydocstyle (Docstring conventions) |
| 21 | + "DTZ", # flake8-datetimez |
| 22 | + "E", # pycodestyle (errors) |
| 23 | + "ERA", # flake8-eradicate (commented out code) |
| 24 | + "EXE", # flake8-executable |
| 25 | + "F", # Pyflakes |
| 26 | + "FA", # flake8-future-annotations |
| 27 | + "FIX", # flake8-fixme |
| 28 | + "FLY", # flynt |
| 29 | + "FURB", # Refurb |
| 30 | + "I", # isort |
| 31 | + "ICN", # flake8-import-conventions |
| 32 | + "INP", # flake8-no-pep420 |
| 33 | + "INT", # flake8-gettext |
| 34 | + "ISC", # flake8-implicit-str-concat |
| 35 | + "ICN", # flake8-import-conventions |
| 36 | + "LOG", # flake8-logging |
| 37 | + "N", # pep8-naming |
| 38 | + "PD", # pandas-vet |
| 39 | + "PERF", # Perflint |
| 40 | + "PIE", # flake8-pie |
| 41 | + "PGH", # pygrep-hooks |
| 42 | + "PL", # Pylint |
| 43 | + "PT", # flake8-pytest-style |
| 44 | + "PTH", # flake8-use-pathlib |
| 45 | + "PYI", # flake8-pyi |
| 46 | + "Q", # flake8-quotes |
| 47 | + "RET", # flake8-return |
| 48 | + "RSE", # flake8-raise |
| 49 | + "RUF", # Ruff-specific rules |
| 50 | + "SIM", # flake8-simplify |
| 51 | + "SLF", # flake8-self |
| 52 | + "SLOT", # flake8-slots |
| 53 | + "T10", # debugger calls |
| 54 | + # "T20", # flake8-print # TODO: Re-enable once we have logging |
| 55 | + "TCH", # flake8-type-checking |
| 56 | + "TD", # flake8-todos |
| 57 | + "TID", # flake8-tidy-imports |
| 58 | + "TRY", # tryceratops |
| 59 | + "TRY002", # Disallow raising vanilla Exception. Create or use a custom exception instead. |
| 60 | + "UP", # pyupgrade |
| 61 | + "W", # pycodestyle (warnings) |
| 62 | + "YTT", # flake8-2020 |
| 63 | +] |
| 64 | + |
| 65 | +[lint] |
| 66 | +ignore = [ |
| 67 | + # For rules reference, see https://docs.astral.sh/ruff/rules/ |
| 68 | + |
| 69 | + # These we don't agree with or don't want to prioritize to enforce: |
| 70 | + "ANN003", # kwargs missing type annotations |
| 71 | + "COM812", # Because it conflicts with ruff auto-format |
| 72 | + "EM", # flake8-errmsgs (may reconsider later) |
| 73 | + "DJ", # Django linting |
| 74 | + "G", # flake8-logging-format |
| 75 | + "ISC001", # Conflicts with ruff auto-format |
| 76 | + "NPY", # NumPy-specific rules |
| 77 | + "PIE790", # Allow unnecssary 'pass' (sometimes useful for readability) |
| 78 | + "PERF203", # exception handling in loop |
| 79 | + "PLR6301", # Allow class methods that don't use 'self' (otherwise noisy) |
| 80 | + "RUF022", # Allow unsorted __all__ (sometimes useful for grouping by type with pdoc) |
| 81 | + "S", # flake8-bandit (noisy, security related) |
| 82 | + "SIM910", # Allow "None" as second argument to Dict.get(). "Explicit is better than implicit." |
| 83 | + "TD002", # Require author for TODOs |
| 84 | + "ASYNC1", # flake8-trio (opinionated, noisy) |
| 85 | + "INP001", # Dir 'examples' is part of an implicit namespace package. Add an __init__.py. |
| 86 | + |
| 87 | + # TODO: Consider re-enabling these before release: |
| 88 | + "A003", # Class attribute 'type' is shadowing a Python builtin |
| 89 | + "BLE001", # Do not catch blind exception: Exception |
| 90 | + "ERA001", # Remove commented-out code |
| 91 | + "FIX002", # Allow "TODO:" until release (then switch to requiring links via TDO003) |
| 92 | + "PLW0603", # Using the global statement to update _cache is discouraged |
| 93 | + "PLW0108", # Lambda may be unnecessary; consider inlining inner function |
| 94 | + "TRY003", # Allow exceptions to receive strings in constructors. |
| 95 | + # "TD003", # Require links for TODOs (now enabled) |
| 96 | + "UP038", # Allow tuples instead of "|" syntax in `isinstance()` checks ("|" is sometimes slower) |
| 97 | +] |
| 98 | +fixable = ["ALL"] |
| 99 | +unfixable = [ |
| 100 | + "ERA001", # Commented-out code (avoid silent loss of code) |
| 101 | + "T201", # print() calls (avoid silent loss of code / log messages) |
| 102 | +] |
| 103 | +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" |
| 104 | + |
| 105 | +[lint.pylint] |
| 106 | +max-args = 8 # Relaxed from default of 5 |
| 107 | +max-branches = 15 # Relaxed from default of 12 |
| 108 | + |
| 109 | +[lint.flake8-import-conventions.aliases] |
| 110 | +airbyte = "ab" |
| 111 | +"airbyte.exceptions" = "exc" |
| 112 | + |
| 113 | +[lint.isort] |
| 114 | +force-sort-within-sections = false |
| 115 | +lines-after-imports = 2 |
| 116 | +known-first-party = [ |
| 117 | + "airbyte_cdk", |
| 118 | + "airbyte_protocol", |
| 119 | + "airbyte_protocol_dataclasses", |
| 120 | +] |
| 121 | +known-local-folder = ["airbyte"] |
| 122 | +required-imports = ["from __future__ import annotations"] |
| 123 | +known-third-party = [] |
| 124 | +section-order = [ |
| 125 | + "future", |
| 126 | + "standard-library", |
| 127 | + "third-party", |
| 128 | + "first-party", |
| 129 | + "local-folder", |
| 130 | +] |
| 131 | + |
| 132 | +[lint.mccabe] |
| 133 | +max-complexity = 24 |
| 134 | + |
| 135 | +[lint.pycodestyle] |
| 136 | +ignore-overlong-task-comments = true |
| 137 | + |
| 138 | +[lint.pydocstyle] |
| 139 | +convention = "google" |
| 140 | + |
| 141 | +[lint.flake8-annotations] |
| 142 | +allow-star-arg-any = false |
| 143 | +ignore-fully-untyped = false |
| 144 | + |
| 145 | +[format] |
| 146 | +quote-style = "double" |
| 147 | +indent-style = "space" |
| 148 | +skip-magic-trailing-comma = false |
| 149 | +line-ending = "auto" |
| 150 | +preview = false |
| 151 | +docstring-code-format = true |
0 commit comments