betagouv / SPPNautSPO

Generator and S3 interface for SPPNaut Startup
European Union Public License 1.2
0 stars 0 forks source link

Activation des hooks de pre-commit ? #14

Open loicguillois opened 2 years ago

loicguillois commented 2 years ago

Est-ce que l'on utilise les pre-commit-hook et/ou configuration de l'éditeur ?

.pre-commit-config.yaml

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.2.0
    hooks:
      - id: trailing-whitespace
      - id: check-executables-have-shebangs
      - id: check-shebang-scripts-are-executable
      - id: check-merge-conflict
      - id: check-symlinks
      - id: check-vcs-permalinks
      - id: detect-private-key
      - id: check-added-large-files
  - repo: https://github.com/ambv/black
    rev: 22.3.0
    hooks:
      - id: black
        language_version: python3.10
  - repo: https://github.com/rtts/djhtml
    rev: v1.5.0
    hooks:
      - id: djhtml
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: "v0.950"
    hooks:
      - id: mypy
  - repo: local
    hooks:
      - id: pylint
        name: PyLint
        entry: pylint PDFGenerator
        language: system
        types: [python]
        pass_filenames: false
  - repo: local
    hooks:
      - id: django-test
        name: django-test
        entry: bash -c 'cd PDFGenerator/http && python manage.py test'
        always_run: true
        pass_filenames: false
        language: system

Mettre à jour le README.md:

## hook de pre-commit

Nous utilisons les hooks de pre-commit définit dans le ficher [.pre-commit-config.yaml](.pre-commit-config.yaml):
* pre-commit-hooks > trailing-whitespace
* pre-commit-hooks > check-added-large-files
* black
* djhtml
* pylint
* mypy
* django tests

Installer les hooks de pre-commit avec la commande

    ```sh
    pre-commit install