|
| 1 | +# The contents of this file is based on https://github.com/home-assistant/core/blob/dev/pyproject.toml |
| 2 | + |
| 3 | +[MAIN] |
| 4 | +# Specify the Python version |
| 5 | +py-version=3.12 |
| 6 | + |
| 7 | +# Use a conservative default here; 2 should speed up most setups and not hurt |
| 8 | +# any too bad. Override on command line as appropriate. |
| 9 | +jobs=2 |
| 10 | + |
| 11 | +load-plugins= |
| 12 | + pylint.extensions.code_style, |
| 13 | + pylint.extensions.typing |
| 14 | + |
| 15 | +persistent = false |
| 16 | +fail-on = [ |
| 17 | + "I", |
| 18 | +] |
| 19 | + |
| 20 | +[BASIC] |
| 21 | +class-const-naming-style = "any" |
| 22 | + |
| 23 | +["MESSAGES CONTROL"] |
| 24 | +# Reasons disabled: |
| 25 | +# format - handled by ruff |
| 26 | +# locally-disabled - it spams too much |
| 27 | +# duplicate-code - unavoidable |
| 28 | +# cyclic-import - doesn't test if both import on load |
| 29 | +# abstract-class-little-used - prevents from setting right foundation |
| 30 | +# unused-argument - generic callbacks and setup methods create a lot of warnings |
| 31 | +# too-many-* - are not enforced for the sake of readability |
| 32 | +# too-few-* - same as too-many-* |
| 33 | +# abstract-method - with intro of async there are always methods missing |
| 34 | +# inconsistent-return-statements - doesn't handle raise |
| 35 | +# too-many-ancestors - it's too strict. |
| 36 | +# wrong-import-order - isort guards this |
| 37 | +# possibly-used-before-assignment - too many errors / not necessarily issues |
| 38 | +# --- |
| 39 | +# Pylint CodeStyle plugin |
| 40 | +# consider-using-namedtuple-or-dataclass - too opinionated |
| 41 | +# consider-using-assignment-expr - decision to use := better left to devs |
| 42 | +disable = [ |
| 43 | + "format", |
| 44 | + "abstract-method", |
| 45 | + "cyclic-import", |
| 46 | + "duplicate-code", |
| 47 | + "inconsistent-return-statements", |
| 48 | + "locally-disabled", |
| 49 | + "not-context-manager", |
| 50 | + "too-few-public-methods", |
| 51 | + "too-many-ancestors", |
| 52 | + "too-many-arguments", |
| 53 | + "too-many-instance-attributes", |
| 54 | + "too-many-lines", |
| 55 | + "too-many-locals", |
| 56 | + "too-many-public-methods", |
| 57 | + "too-many-boolean-expressions", |
| 58 | + "too-many-positional-arguments", |
| 59 | + "wrong-import-order", |
| 60 | + "consider-using-namedtuple-or-dataclass", |
| 61 | + "consider-using-assignment-expr", |
| 62 | + "possibly-used-before-assignment", |
| 63 | + |
| 64 | + # Handled by ruff |
| 65 | + # Ref: <https://github.com/astral-sh/ruff/issues/970> |
| 66 | + "await-outside-async", # PLE1142 |
| 67 | + "bad-str-strip-call", # PLE1310 |
| 68 | + "bad-string-format-type", # PLE1307 |
| 69 | + "bidirectional-unicode", # PLE2502 |
| 70 | + "continue-in-finally", # PLE0116 |
| 71 | + "duplicate-bases", # PLE0241 |
| 72 | + "misplaced-bare-raise", # PLE0704 |
| 73 | + "format-needs-mapping", # F502 |
| 74 | + "function-redefined", # F811 |
| 75 | + # Needed because ruff does not understand type of __all__ generated by a function |
| 76 | + # "invalid-all-format", # PLE0605 |
| 77 | + "invalid-all-object", # PLE0604 |
| 78 | + "invalid-character-backspace", # PLE2510 |
| 79 | + "invalid-character-esc", # PLE2513 |
| 80 | + "invalid-character-nul", # PLE2514 |
| 81 | + "invalid-character-sub", # PLE2512 |
| 82 | + "invalid-character-zero-width-space", # PLE2515 |
| 83 | + "logging-too-few-args", # PLE1206 |
| 84 | + "logging-too-many-args", # PLE1205 |
| 85 | + "missing-format-string-key", # F524 |
| 86 | + "mixed-format-string", # F506 |
| 87 | + "no-method-argument", # N805 |
| 88 | + "no-self-argument", # N805 |
| 89 | + "nonexistent-operator", # B002 |
| 90 | + "nonlocal-without-binding", # PLE0117 |
| 91 | + "not-in-loop", # F701, F702 |
| 92 | + "notimplemented-raised", # F901 |
| 93 | + "return-in-init", # PLE0101 |
| 94 | + "return-outside-function", # F706 |
| 95 | + "syntax-error", # E999 |
| 96 | + "too-few-format-args", # F524 |
| 97 | + "too-many-format-args", # F522 |
| 98 | + "too-many-star-expressions", # F622 |
| 99 | + "truncated-format-string", # F501 |
| 100 | + "undefined-all-variable", # F822 |
| 101 | + "undefined-variable", # F821 |
| 102 | + "used-prior-global-declaration", # PLE0118 |
| 103 | + "yield-inside-async-function", # PLE1700 |
| 104 | + "yield-outside-function", # F704 |
| 105 | + "anomalous-backslash-in-string", # W605 |
| 106 | + "assert-on-string-literal", # PLW0129 |
| 107 | + "assert-on-tuple", # F631 |
| 108 | + "bad-format-string", # W1302, F |
| 109 | + "bad-format-string-key", # W1300, F |
| 110 | + "bare-except", # E722 |
| 111 | + "binary-op-exception", # PLW0711 |
| 112 | + "cell-var-from-loop", # B023 |
| 113 | + # "dangerous-default-value", # B006, ruff catches new occurrences, needs more work |
| 114 | + "duplicate-except", # B014 |
| 115 | + "duplicate-key", # F601 |
| 116 | + "duplicate-string-formatting-argument", # F |
| 117 | + "duplicate-value", # F |
| 118 | + "eval-used", # S307 |
| 119 | + "exec-used", # S102 |
| 120 | + "expression-not-assigned", # B018 |
| 121 | + "f-string-without-interpolation", # F541 |
| 122 | + "forgotten-debug-statement", # T100 |
| 123 | + "format-string-without-interpolation", # F |
| 124 | + # "global-statement", # PLW0603, ruff catches new occurrences, needs more work |
| 125 | + "global-variable-not-assigned", # PLW0602 |
| 126 | + "implicit-str-concat", # ISC001 |
| 127 | + "import-self", # PLW0406 |
| 128 | + "inconsistent-quotes", # Q000 |
| 129 | + "invalid-envvar-default", # PLW1508 |
| 130 | + "keyword-arg-before-vararg", # B026 |
| 131 | + "logging-format-interpolation", # G |
| 132 | + "logging-fstring-interpolation", # G |
| 133 | + "logging-not-lazy", # G |
| 134 | + "misplaced-future", # F404 |
| 135 | + "named-expr-without-context", # PLW0131 |
| 136 | + "nested-min-max", # PLW3301 |
| 137 | + "pointless-statement", # B018 |
| 138 | + "raise-missing-from", # B904 |
| 139 | + "redefined-builtin", # A001 |
| 140 | + "try-except-raise", # TRY302 |
| 141 | + "unused-argument", # ARG001, we don't use it |
| 142 | + "unused-format-string-argument", #F507 |
| 143 | + "unused-format-string-key", # F504 |
| 144 | + "unused-import", # F401 |
| 145 | + "unused-variable", # F841 |
| 146 | + "useless-else-on-loop", # PLW0120 |
| 147 | + "wildcard-import", # F403 |
| 148 | + "bad-classmethod-argument", # N804 |
| 149 | + "consider-iterating-dictionary", # SIM118 |
| 150 | + "empty-docstring", # D419 |
| 151 | + "invalid-name", # N815 |
| 152 | + "line-too-long", # E501, disabled globally |
| 153 | + "missing-class-docstring", # D101 |
| 154 | + "missing-final-newline", # W292 |
| 155 | + "missing-function-docstring", # D103 |
| 156 | + "missing-module-docstring", # D100 |
| 157 | + "multiple-imports", #E401 |
| 158 | + "singleton-comparison", # E711, E712 |
| 159 | + "subprocess-run-check", # PLW1510 |
| 160 | + "superfluous-parens", # UP034 |
| 161 | + "ungrouped-imports", # I001 |
| 162 | + "unidiomatic-typecheck", # E721 |
| 163 | + "unnecessary-direct-lambda-call", # PLC3002 |
| 164 | + "unnecessary-lambda-assignment", # PLC3001 |
| 165 | + "unnecessary-pass", # PIE790 |
| 166 | + "unneeded-not", # SIM208 |
| 167 | + "useless-import-alias", # PLC0414 |
| 168 | + "wrong-import-order", # I001 |
| 169 | + "wrong-import-position", # E402 |
| 170 | + "comparison-of-constants", # PLR0133 |
| 171 | + "comparison-with-itself", # PLR0124 |
| 172 | + "consider-alternative-union-syntax", # UP007 |
| 173 | + "consider-merging-isinstance", # PLR1701 |
| 174 | + "consider-using-alias", # UP006 |
| 175 | + "consider-using-dict-comprehension", # C402 |
| 176 | + "consider-using-generator", # C417 |
| 177 | + "consider-using-get", # SIM401 |
| 178 | + "consider-using-set-comprehension", # C401 |
| 179 | + "consider-using-sys-exit", # PLR1722 |
| 180 | + "consider-using-ternary", # SIM108 |
| 181 | + "literal-comparison", # F632 |
| 182 | + "property-with-parameters", # PLR0206 |
| 183 | + "super-with-arguments", # UP008 |
| 184 | + "too-many-branches", # PLR0912 |
| 185 | + "too-many-return-statements", # PLR0911 |
| 186 | + "too-many-statements", # PLR0915 |
| 187 | + "trailing-comma-tuple", # COM818 |
| 188 | + "unnecessary-comprehension", # C416 |
| 189 | + "use-a-generator", # C417 |
| 190 | + "use-dict-literal", # C406 |
| 191 | + "use-list-literal", # C405 |
| 192 | + "useless-object-inheritance", # UP004 |
| 193 | + "useless-return", # PLR1711 |
| 194 | + "no-else-break", # RET508 |
| 195 | + "no-else-continue", # RET507 |
| 196 | + "no-else-raise", # RET506 |
| 197 | + "no-else-return", # RET505 |
| 198 | + "broad-except", # BLE001 |
| 199 | + "protected-access", # SLF001 |
| 200 | + "broad-exception-raised", # TRY002 |
| 201 | + "consider-using-f-string", # PLC0209 |
| 202 | + # "no-self-use", # PLR6301 # Optional plugin, not enabled |
| 203 | + |
| 204 | + # Handled by mypy |
| 205 | + # Ref: <https://github.com/antonagestam/pylint-mypy-overlap> |
| 206 | + "abstract-class-instantiated", |
| 207 | + "arguments-differ", |
| 208 | + "assigning-non-slot", |
| 209 | + "assignment-from-no-return", |
| 210 | + "assignment-from-none", |
| 211 | + "bad-exception-cause", |
| 212 | + "bad-format-character", |
| 213 | + "bad-reversed-sequence", |
| 214 | + "bad-super-call", |
| 215 | + "bad-thread-instantiation", |
| 216 | + "catching-non-exception", |
| 217 | + "comparison-with-callable", |
| 218 | + "deprecated-class", |
| 219 | + "dict-iter-missing-items", |
| 220 | + "format-combined-specification", |
| 221 | + "global-variable-undefined", |
| 222 | + "import-error", |
| 223 | + "inconsistent-mro", |
| 224 | + "inherit-non-class", |
| 225 | + "init-is-generator", |
| 226 | + "invalid-class-object", |
| 227 | + "invalid-enum-extension", |
| 228 | + "invalid-envvar-value", |
| 229 | + "invalid-format-returned", |
| 230 | + "invalid-hash-returned", |
| 231 | + "invalid-metaclass", |
| 232 | + "invalid-overridden-method", |
| 233 | + "invalid-repr-returned", |
| 234 | + "invalid-sequence-index", |
| 235 | + "invalid-slice-index", |
| 236 | + "invalid-slots-object", |
| 237 | + "invalid-slots", |
| 238 | + "invalid-star-assignment-target", |
| 239 | + "invalid-str-returned", |
| 240 | + "invalid-unary-operand-type", |
| 241 | + "invalid-unicode-codec", |
| 242 | + "isinstance-second-argument-not-valid-type", |
| 243 | + "method-hidden", |
| 244 | + "misplaced-format-function", |
| 245 | + "missing-format-argument-key", |
| 246 | + "missing-format-attribute", |
| 247 | + "missing-kwoa", |
| 248 | + "no-member", |
| 249 | + "no-value-for-parameter", |
| 250 | + "non-iterator-returned", |
| 251 | + "non-str-assignment-to-dunder-name", |
| 252 | + "nonlocal-and-global", |
| 253 | + "not-a-mapping", |
| 254 | + "not-an-iterable", |
| 255 | + "not-async-context-manager", |
| 256 | + "not-callable", |
| 257 | + "not-context-manager", |
| 258 | + "overridden-final-method", |
| 259 | + "raising-bad-type", |
| 260 | + "raising-non-exception", |
| 261 | + "redundant-keyword-arg", |
| 262 | + "relative-beyond-top-level", |
| 263 | + "self-cls-assignment", |
| 264 | + "signature-differs", |
| 265 | + "star-needs-assignment-target", |
| 266 | + "subclassed-final-class", |
| 267 | + "super-without-brackets", |
| 268 | + "too-many-function-args", |
| 269 | + "typevar-double-variance", |
| 270 | + "typevar-name-mismatch", |
| 271 | + "unbalanced-dict-unpacking", |
| 272 | + "unbalanced-tuple-unpacking", |
| 273 | + "unexpected-keyword-arg", |
| 274 | + "unhashable-member", |
| 275 | + "unpacking-non-sequence", |
| 276 | + "unsubscriptable-object", |
| 277 | + "unsupported-assignment-operation", |
| 278 | + "unsupported-binary-operation", |
| 279 | + "unsupported-delete-operation", |
| 280 | + "unsupported-membership-test", |
| 281 | + "used-before-assignment", |
| 282 | + "using-final-decorator-in-unsupported-version", |
| 283 | + "wrong-exception-operation", |
| 284 | +] |
| 285 | +enable = [ |
| 286 | + #"useless-suppression", # temporarily every now and then to clean them up |
| 287 | + "use-symbolic-message-instead", |
| 288 | +] |
| 289 | +per-file-ignores = [ |
| 290 | + # redefined-outer-name: Tests reference fixtures in the test function |
| 291 | + # use-implicit-booleaness-not-comparison: Tests need to validate that a list |
| 292 | + # or a dict is returned |
| 293 | + "/tests/:redefined-outer-name,use-implicit-booleaness-not-comparison", |
| 294 | +] |
| 295 | + |
| 296 | +[REPORTS] |
| 297 | +score = false |
| 298 | + |
| 299 | +[TYPECHECK] |
| 300 | +ignored-classes = [ |
| 301 | + "_CountingAttr", # for attrs |
| 302 | +] |
| 303 | +mixin-class-rgx = ".*[Mm]ix[Ii]n" |
| 304 | + |
| 305 | +[FORMAT] |
| 306 | +expected-line-ending-format = "LF" |
| 307 | + |
| 308 | +[EXCEPTIONS] |
| 309 | +overgeneral-exceptions = [ |
| 310 | + "builtins.BaseException", |
| 311 | + "builtins.Exception", |
| 312 | + # "homeassistant.exceptions.HomeAssistantError", # too many issues |
| 313 | +] |
| 314 | + |
| 315 | +[TYPING] |
| 316 | +runtime-typing = false |
| 317 | + |
| 318 | +[CODE_STYLE] |
| 319 | +max-line-length-suggestions = 72 |
0 commit comments