repos:
  - repo: local
    hooks:
      - id: black
        name: black
        # entry: bash -c 'cd spiffworkflow-backend && black'
        entry: black
        language: system
        files: ^spiffworkflow-backend/
        types: [python]
        require_serial: true
        # exclude: ^migrations/
        exclude: "/migrations/"

        # otherwise it will not fix long lines if the long lines contain long strings
        # https://github.com/psf/black/pull/1132
        # https://github.com/psf/black/pull/1609
        args: [--preview]

      - id: check-added-large-files
        files: ^spiffworkflow-backend/
        name: Check for added large files
        entry: check-added-large-files
        language: system
      - id: check-toml
        files: ^spiffworkflow-backend/
        name: Check Toml
        entry: check-toml
        language: system
        types: [toml]
      - id: check-yaml
        files: ^spiffworkflow-backend/
        name: Check Yaml
        entry: check-yaml
        language: system
        types: [yaml]
      - id: end-of-file-fixer
        files: ^spiffworkflow-backend/
        name: Fix End of Files
        entry: end-of-file-fixer
        language: system
        types: [text]
        stages: [commit, push, manual]
      - id: flake8
        files: ^spiffworkflow-backend/
        name: flake8
        entry: flake8
        language: system
        types: [python]
        require_serial: true
        exclude: "/migrations/"
      - id: pyupgrade
        files: ^spiffworkflow-backend/
        name: pyupgrade
        description: Automatically upgrade syntax for newer versions.
        entry: pyupgrade
        language: system
        types: [python]
        args: [--py37-plus]
      - id: reorder-python-imports
        files: ^spiffworkflow-backend/
        name: Reorder python imports
        entry: reorder-python-imports
        language: system
        types: [python]
        args: [--application-directories=spiffworkflow-backend/src]
        exclude: "(/migrations/|load_database_models)"
      - id: trailing-whitespace
        files: ^spiffworkflow-backend/
        name: Trim Trailing Whitespace
        entry: trailing-whitespace-fixer
        language: system
        types: [text]
        stages: [commit, push, manual]
        exclude: "/migrations/"
  # - repo: https://github.com/pre-commit/mirrors-prettier
  #   rev: v2.4.1
  #   hooks:
  #     - id: prettier
  #       files: ^spiffworkflow-backend/
  #       exclude_types: [html]