Created
April 4, 2023 17:33
-
-
Save elydev01/fc464b2fa2547ecf8320afe8d06d49fb to your computer and use it in GitHub Desktop.
PRECOMMIT DIRECTIVE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# PRECOMMIT DIRECTIVE | |
# python -m pip install pre-commit | |
# pre-commit install | |
# pre-commit run --all-files | |
# **************************************************************** | |
repos: | |
- repo: https://github.com/pre-commit/pre-commit-hooks | |
rev: v4.0.1 | |
hooks: | |
- id: check-merge-conflict | |
- id: trailing-whitespace | |
# **************************************************************** | |
# Format Python | |
- repo: https://github.com/psf/black | |
rev: 23.3.0 | |
hooks: | |
- id: black | |
name: black (python) | |
# args: [--diff, --check] | |
# args: [--line-length=79, --target-version=py37] | |
# language_version: python3.9 | |
# **************************************************************** | |
# Lint Python | |
- repo: https://gitlab.com/pycqa/flake8 | |
rev: 6.0.0 | |
hooks: | |
- id: flake8 | |
args: ['--ignore=E501,W503'] | |
# args: ['--ignore=E501,W503', '--exclude=__init__.py'] | |
# **************************************************************** | |
# Isort python | |
- repo: https://github.com/pycqa/isort | |
rev: 5.12.0 | |
hooks: | |
- id: isort | |
name: isort (python) | |
# **************************************************************** | |
- repo: https://github.com/PyCQA/bandit | |
rev: 1.7.5 | |
hooks: | |
- id: bandit | |
name: bandit | |
entry: bandit | |
language: python | |
language_version: python3 | |
# files: .py$ | |
# types: [python] | |
# args: [--verbose, --ini, .banditrc, -ll, --skip, "B321,B402", --recursive, src/lib] | |
# **************************************************************** | |
- repo: local | |
hooks: | |
- id: pylint | |
name: pylint | |
entry: pylint | |
language: system | |
types: [python] | |
require_serial: true | |
args: | |
[ | |
"-rn", # Only display messages | |
"-sn", # Don't display the score | |
] | |
# **************************************************************** | |
- repo: https://github.com/pre-commit/mirrors-mypy | |
rev: v0.800 | |
hooks: | |
- id: mypy | |
exclude: ^tests/ | |
# args: [--no-strict-optional, --strict, --ignore-missing-imports] | |
# **************************************************************** | |
# ---------------------------------------------------------------- | |
# Voici une liste des plugins pre-commit couramment utilisés pour les projets Python : | |
# ---------------------------------------------------------------- | |
# black : formate votre code selon le style de code Black. | |
# flake8 : vérifie la conformité de votre code aux règles PEP8 et détecte d'autres problèmes de code. | |
# isort : trie vos imports par ordre alphabétique et les sépare automatiquement en sections. | |
# mypy : effectue une vérification de type statique pour Python. | |
# pylint : vérifie votre code pour les erreurs, les bogues potentiels et les code smells. | |
# bandit : détecte les problèmes de sécurité courants dans le code Python. | |
# safety : vérifie vos dépendances pour déceler les vulnérabilités de sécurité connues. | |
# yapf : autre formateur de code, similaire à Black mais avec un ensemble différent d'options de configuration. | |
# docformatter : impose des normes de formatage pour les docstrings (contenu à l'intérieur de triple guillemets). | |
# pre_commit_hooks : une collection de hooks pour vérifier les messages de commit, les fichiers, la validation YAML, et plus encore. | |
# ---------------------------------------------------------------- | |
# Ces plugins peuvent être utilisés ensemble ou individuellement pour améliorer la qualité et la sécurité du code dans un projet Python. | |
# ---------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment