|
| 1 | +# We keep the ruff configuration separate so it can easily be shared across |
| 2 | +# all projects |
| 3 | + |
| 4 | +target-version = 'py39' |
| 5 | + |
| 6 | +exclude = [ |
| 7 | + '.venv', |
| 8 | + '.tox', |
| 9 | + 'test.py', |
| 10 | +] |
| 11 | + |
| 12 | +lint.ignore = [ |
| 13 | + 'A001', # Variable {name} is shadowing a Python builtin |
| 14 | + 'A002', # Argument {name} is shadowing a Python builtin |
| 15 | + 'A003', # Class attribute {name} is shadowing a Python builtin |
| 16 | + 'B023', # function-uses-loop-variable |
| 17 | + 'B024', # `FormatWidgetMixin` is an abstract base class, but it has no abstract methods |
| 18 | + 'D205', # blank-line-after-summary |
| 19 | + 'D212', # multi-line-summary-first-line |
| 20 | + 'RET505', # Unnecessary `else` after `return` statement |
| 21 | + 'TRY003', # Avoid specifying long messages outside the exception class |
| 22 | + 'RET507', # Unnecessary `elif` after `continue` statement |
| 23 | + 'C405', # Unnecessary {obj_type} literal (rewrite as a set literal) |
| 24 | + 'C406', # Unnecessary {obj_type} literal (rewrite as a dict literal) |
| 25 | + 'C408', # Unnecessary {obj_type} call (rewrite as a literal) |
| 26 | + 'SIM114', # Combine `if` branches using logical `or` operator |
| 27 | + 'RET506', # Unnecessary `else` after `raise` statement |
| 28 | + 'Q001', # Remove bad quotes |
| 29 | + 'Q002', # Remove bad quotes |
| 30 | + 'COM812', # Missing trailing comma in a list |
| 31 | + 'ISC001', # String concatenation with implicit str conversion |
| 32 | + 'SIM108', # Ternary operators are not always more readable |
| 33 | + 'RUF100', # Unused `noqa` directive. These vary per Python version so this warning is often incorrect. |
| 34 | +] |
| 35 | +line-length = 79 |
| 36 | +lint.select = [ |
| 37 | + 'A', # flake8-builtins |
| 38 | + 'ASYNC', # flake8 async checker |
| 39 | + 'B', # flake8-bugbear |
| 40 | + 'C4', # flake8-comprehensions |
| 41 | + 'C90', # mccabe |
| 42 | + 'COM', # flake8-commas |
| 43 | + |
| 44 | + ## Require docstrings for all public methods, would be good to enable at some point |
| 45 | + 'D', # pydocstyle |
| 46 | + |
| 47 | + 'E', # pycodestyle error ('W' for warning) |
| 48 | + 'F', # pyflakes |
| 49 | + 'FA', # flake8-future-annotations |
| 50 | + 'I', # isort |
| 51 | + 'ICN', # flake8-import-conventions |
| 52 | + 'INP', # flake8-no-pep420 |
| 53 | + 'ISC', # flake8-implicit-str-concat |
| 54 | + 'N', # pep8-naming |
| 55 | + 'NPY', # NumPy-specific rules |
| 56 | + 'PERF', # perflint, |
| 57 | + 'PIE', # flake8-pie |
| 58 | + 'Q', # flake8-quotes |
| 59 | + |
| 60 | + 'RET', # flake8-return |
| 61 | + 'RUF', # Ruff-specific rules |
| 62 | + 'SIM', # flake8-simplify |
| 63 | + 'T20', # flake8-print |
| 64 | + 'TD', # flake8-todos |
| 65 | + 'TRY', # tryceratops |
| 66 | + 'UP', # pyupgrade |
| 67 | +] |
| 68 | + |
| 69 | +[lint.per-file-ignores] |
| 70 | +'*tests/*' = ['INP001', 'T201', 'T203', 'ASYNC109', 'B007'] |
| 71 | +'examples.py' = ['T201', 'N806'] |
| 72 | +'docs/conf.py' = ['E501', 'INP001'] |
| 73 | +'docs/_theme/flask_theme_support.py' = ['RUF012', 'INP001'] |
| 74 | +'*/types.py' = ['F405'] |
| 75 | + |
| 76 | +[lint.pydocstyle] |
| 77 | +convention = 'google' |
| 78 | +ignore-decorators = [ |
| 79 | + 'typing.overload', |
| 80 | + 'typing.override', |
| 81 | +] |
| 82 | + |
| 83 | +[lint.isort] |
| 84 | +case-sensitive = true |
| 85 | +combine-as-imports = true |
| 86 | +force-wrap-aliases = true |
| 87 | + |
| 88 | +[lint.flake8-quotes] |
| 89 | +docstring-quotes = 'single' |
| 90 | +inline-quotes = 'single' |
| 91 | +multiline-quotes = 'single' |
| 92 | + |
| 93 | +[format] |
| 94 | +line-ending = 'lf' |
| 95 | +indent-style = 'space' |
| 96 | +quote-style = 'single' |
| 97 | +docstring-code-format = true |
| 98 | +skip-magic-trailing-comma = false |
| 99 | +exclude = [ |
| 100 | + '__init__.py', |
| 101 | +] |
| 102 | + |
| 103 | +[lint.pycodestyle] |
| 104 | +max-line-length = 79 |
| 105 | + |
| 106 | +[lint.flake8-pytest-style] |
| 107 | +mark-parentheses = true |
0 commit comments