lang:python:linter
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédente | |||
| lang:python:linter [2021/04/11 20:48] – Ajout de "safety" root | lang:python:linter [2025/10/02 12:59] (Version actuelle) – Mise à jour de (preque) tous les linters root | ||
|---|---|---|---|
| Ligne 69: | Ligne 69: | ||
| {{ : | {{ : | ||
| - | Arguments à activer, ici dans un fichier racine '' | + | ====Options==== |
| - | <file ini .mypy.ini> | + | Fichier '' |
| - | [mypy] | + | |
| - | ignore_missing_imports | + | * Règles générales: |
| - | follow_imports = silent | + | |
| - | show_column_numbers = True | + | <file ini pyproject.toml> |
| - | disallow_untyped_calls = True | + | [tool.mypy] |
| - | disallow_untyped_defs = True | + | files = " |
| - | disallow_incomplete_defs = True | + | exclude = [" |
| - | check_untyped_defs = True | + | follow_imports = " |
| - | no_implicit_optional | + | show_column_numbers = true |
| - | warn_redundant_casts = True | + | ignore_missing_imports = true |
| - | warn_unused_ignores = True | + | |
| - | warn_unreachable = True | + | # Importations |
| - | strict_equality = True | + | disallow_any_unimported = true |
| + | disallow_any_expr = true | ||
| + | disallow_any_decorated = true | ||
| + | disallow_any_explicit = true | ||
| + | disallow_any_generics = true | ||
| + | disallow_subclassing_any = true | ||
| + | |||
| + | # Annotations | ||
| + | disallow_untyped_calls = true | ||
| + | disallow_untyped_defs = true | ||
| + | disallow_incomplete_defs = true | ||
| + | check_untyped_defs = true | ||
| + | disallow_untyped_decorators | ||
| + | |||
| + | # None et Optional | ||
| + | implicit_optional = true | ||
| + | strict_optional = true | ||
| + | |||
| + | # Warnings | ||
| + | warn_redundant_casts = true | ||
| + | warn_unused_ignores = true | ||
| + | warn_no_return = true | ||
| + | warn_return_any = true | ||
| + | warn_unreachable = true | ||
| + | |||
| + | # Comportement strict | ||
| + | strict_equality = true | ||
| + | extra_checks = true | ||
| + | local_partial_types = true | ||
| + | |||
| + | # Divers | ||
| + | implicit_reexport = false | ||
| + | strict = true | ||
| </ | </ | ||
| - | Il est aussi possible d' | + | * Règles spécifiques à un ou plusieurs fichiers |
| - | < | + | Pour le module '' |
| - | --disallow-any-unimported --disallow-any-expr --disallow-any-decorated --disallow-any-explicit --disallow-any-generics --disallow-subclassing-any | + | |
| + | < | ||
| + | [[tool.mypy.overrides]] | ||
| + | module = [" | ||
| + | ignore_missing_imports = true | ||
| </ | </ | ||
| + | |||
| + | Pour le fichier '' | ||
| + | |||
| + | <code ini> | ||
| + | [[tool.mypy.overrides]] | ||
| + | module = " | ||
| + | ignore_errors = true | ||
| + | </ | ||
| + | |||
| + | =====pyright===== | ||
| + | |||
| + | Analyseur statique de code spécialisé dans le typing. | ||
| + | |||
| + | [[https:// | ||
| + | |||
| + | ====Options==== | ||
| + | |||
| + | <code ini pyproject.toml> | ||
| + | [tool.pyright] | ||
| + | ignore = [" | ||
| + | typeCheckingMode = " | ||
| + | </ | ||
| + | |||
| + | '' | ||
| + | |||
| + | Attention à '' | ||
| =====Black===== | =====Black===== | ||
| Ligne 101: | Ligne 163: | ||
| {{ : | {{ : | ||
| - | La presque seule option disponible est : | + | ====Options==== |
| - | '' | + | <code ini pyproject.toml> |
| + | [tool.black] | ||
| + | line-length = 79 | ||
| + | extend-exclude = '\.pyi$' | ||
| + | </ | ||
| =====prospector===== | =====prospector===== | ||
| Ligne 127: | Ligne 193: | ||
| =====flake8===== | =====flake8===== | ||
| - | Il n'y a presque rien a paramétrer. | + | Analyseur du style de code et inclut |
| - | Il existe | + | On peut installer |
| + | |||
| + | Ne pas utiliser '' | ||
| + | |||
| + | ====Options==== | ||
| + | |||
| + | Il faut utiliser le fichier '' | ||
| <file ini tox.ini> | <file ini tox.ini> | ||
| [flake8] | [flake8] | ||
| + | # Désactiver les conflits de formattage avec black. | ||
| ignore = E203, W503 | ignore = E203, W503 | ||
| - | application-import-names = ...,... | + | max-line-length |
| - | import-order-style = google | + | |
| - | </ | + | |
| - | On ignore les erreurs de formatage en conflit avec Black. | + | exclude = install, |
| - | '' | + | import-order-style = google |
| + | |||
| + | # Est utilisé par '' | ||
| + | application-import-names = ... | ||
| + | </ | ||
| =====safety===== | =====safety===== | ||
lang/python/linter.1618166886.txt.gz · Dernière modification : de root
