|
| 1 | +# https://docs.astral.sh/ruff/configuration/ |
| 2 | + |
| 3 | +# Exclude a variety of commonly ignored directories. |
| 4 | +exclude = [ |
| 5 | + ".bzr", |
| 6 | + ".direnv", |
| 7 | + ".eggs", |
| 8 | + ".git", |
| 9 | + ".git-rewrite", |
| 10 | + ".hg", |
| 11 | + ".mypy_cache", |
| 12 | + ".nox", |
| 13 | + ".pants.d", |
| 14 | + ".pytype", |
| 15 | + ".ruff_cache", |
| 16 | + ".svn", |
| 17 | + ".tox", |
| 18 | + ".venv", |
| 19 | + "__pypackages__", |
| 20 | + "_build", |
| 21 | + "buck-out", |
| 22 | + "build", |
| 23 | + "dist", |
| 24 | + "node_modules", |
| 25 | + "venv", |
| 26 | + ".venv", |
| 27 | + "docs", |
| 28 | + "*.ipynb", |
| 29 | + "*.md", |
| 30 | +] |
| 31 | + |
| 32 | +# Same as Black. |
| 33 | +line-length = 88 |
| 34 | +indent-width = 4 |
| 35 | + |
| 36 | +# Assume Python 3.10 |
| 37 | +target-version = "py310" |
| 38 | + |
| 39 | +[lint] |
| 40 | +# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default. |
| 41 | +select = [ |
| 42 | + # pycodestyle |
| 43 | + "E", |
| 44 | + # Pyflakes |
| 45 | + "F", |
| 46 | + # pyupgrade |
| 47 | + "UP", |
| 48 | + # flake8-bugbear |
| 49 | + "B", |
| 50 | + # flake8-simplify |
| 51 | + "SIM", |
| 52 | + # isort |
| 53 | + "I", |
| 54 | + # Warning |
| 55 | + "W", |
| 56 | + # pydocstyle |
| 57 | + "D100", "D101", "D102", "D103", "D104", "D105", "D106", "D107", |
| 58 | + # ruff |
| 59 | + "RUF", |
| 60 | + # McCabe Complexity |
| 61 | + "C90", |
| 62 | + # pep8-naming (N) |
| 63 | + "N", |
| 64 | + # flake8-2020 (YTT) |
| 65 | + "YTT", |
| 66 | + # flake8-annotations (ANN) |
| 67 | + "ANN", |
| 68 | + # flake8-async |
| 69 | + "ASYNC", |
| 70 | + # flake8-bandit |
| 71 | + "S", |
| 72 | + # flake8-commas |
| 73 | + "COM", |
| 74 | + # flake8-use-pathlib |
| 75 | + "PTH", |
| 76 | + # FastAPI |
| 77 | + "FAST", |
| 78 | + # flake8-logging |
| 79 | + "LOG", |
| 80 | + # flake8-comprehensions |
| 81 | + "C4", |
| 82 | + # flake8-pie |
| 83 | + "PIE", |
| 84 | + # flake8-return |
| 85 | + "RET", |
| 86 | + # Pylint |
| 87 | + "PL", |
| 88 | + # eradicate |
| 89 | + "ERA", |
| 90 | + # refurb |
| 91 | + "FURB", |
| 92 | + # flake-8-unused-arguments |
| 93 | + "ARG", |
| 94 | + # flake-8-print |
| 95 | + "T20", |
| 96 | +] |
| 97 | +ignore = [ |
| 98 | + "E501", # Line too long |
| 99 | + "B006", # Do not use mutable data structures for argument defaults |
| 100 | + "ANN401", # Don't flag Any types |
| 101 | + "COM812", # Don't fight over trailing commas |
| 102 | + "PLR0913", # Allow for a reasonable number of arguments |
| 103 | + "PLR2004", # Magic value used in comparison |
| 104 | + "UP006", # Ignoring errors for typing types such as Dict or List |
| 105 | + "UP045", # Ignoring errors for Unions |
| 106 | + "UP007", # Ignoring errors for Optional |
| 107 | + "UP035", # Ignoring errors for typing types such as Dict or List |
| 108 | + "S311", # Ignoring use of standard random number generators |
| 109 | +] |
| 110 | + |
| 111 | +# Allow fix for all enabled rules (when `--fix`) is provided. |
| 112 | +fixable = ["ALL"] |
| 113 | +unfixable = [] |
| 114 | + |
| 115 | +# Allow unused variables when underscore-prefixed. |
| 116 | +dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$" |
| 117 | + |
| 118 | +[lint.per-file-ignores] |
| 119 | +"**/tests/**/*.py" = ["S101", "ANN", "D", "ARG002"] |
| 120 | +"**/*.ipynb" = ["T20"] |
| 121 | +"scripts/**/*.py" = ["D", "T20", "S101", "C901", "SIM", "C401"] |
| 122 | +"**/cli/**/*.py" = ["PLC0415"] # Allow lazy imports in CLI for startup performance |
| 123 | + |
| 124 | +[format] |
| 125 | +# Like Black, use double quotes for strings. |
| 126 | +quote-style = "double" |
| 127 | + |
| 128 | +# Like Black, indent with spaces, rather than tabs. |
| 129 | +indent-style = "space" |
| 130 | + |
| 131 | +# Like Black, respect magic trailing commas. |
| 132 | +skip-magic-trailing-comma = false |
| 133 | + |
| 134 | +# Like Black, automatically detect the appropriate line ending. |
| 135 | +line-ending = "auto" |
0 commit comments