alan-turing-institute / empiarreader

Reader for EMPIAR datasets
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

Add .pre-commit-config.yaml? #21

Closed JatGreer closed 1 year ago

JatGreer commented 1 year ago

I find it useful to use a .pre-commit-config.yaml to make sure the code I commit is standardised. Do we want to use one? If so, here's an example we could start with:

repos:
  - repo: https://github.com/psf/black
    rev: 23.1.0  
    hooks:
      - id: black
        args:
        - --line-length=79
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-added-large-files
        args: ['maxkb=500']
      - id: check-ast
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-merge-conflict
      - id: check-toml
      - id: check-yaml
  - repo: https://github.com/pycqa/flake8
    rev: 6.0.0
    hooks:
      - id: flake8
        args:
        - "--ignore=E203,W503"
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.1.1
    hooks:
      - id: mypy
        additional_dependencies: [types-setuptools]
  - repo: local
    hooks:
      - id: pytest
        stages: [commit, push]
        types: [python]
        name: pytest
        entry: pytest
        pass_filenames: false
        language: system
        always_run: true