# See https://pre-commit.com for more information
# See https://pre-commit.ci for more information
ci:
  #skip: [prettier, alex]
  skip: [prettier]
  # Forĝejo/Gitea mirrors will autoclose pull requests. This should decrease
  # the frequency of unnecessary PRs.
  # https://github.com/pre-commit-ci/issues/issues/83
  autoupdate_schedule: quarterly
default_language_version:
  node: "lts"
  ruby: ".ruby-version"
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: trailing-whitespace
        args: ["--markdown-linebreak-ext", "md,markdown"]
        exclude_types: [svg, tsv]
        #- id: end-of-file-fixer
      - id: check-yaml
      - id: check-added-large-files
      - id: check-case-conflict
      - id: check-executables-have-shebangs
      - id: check-json
      - id: check-merge-conflict
      - id: check-shebang-scripts-are-executable
      - id: check-toml
      - id: check-xml
      - id: destroyed-symlinks
      - id: detect-private-key
      - id: fix-byte-order-marker
      - id: check-merge-conflict
      - id: mixed-line-ending
        args: [--fix=auto]
      - id: pretty-format-json
        # TODO: Does uBlock Origin really demand this?
        #exclude: ^etc\/firefox\/policies\/policies.json|etc\/opt\/chromium\/policies\/managed\/aminda-extensions.json$
        args:
          # Remember also: --no-sort-keys
          # ASCII excludes the älphäbet amongst others
          [
            --autofix,
            --indent,
            "\t",
            --no-ensure-ascii,
            --top-keys,
            "Name,name,domain",
          ]
      - id: check-illegal-windows-names
  - repo: https://github.com/pre-commit-ci/pre-commit-ci-config
    rev: v1.6.1
    hooks:
      - id: check-pre-commit-ci-config
  # Markdown Table of Contents generation.
  - repo: https://github.com/thlorenz/doctoc
    rev: v2.2.0
    hooks:
      - id: doctoc
        # https://github.com/Mikaela/gist/blob/master/doctoc.txt
        args: [--update-only, --notitle]
        #args:  [
        #    --update-only,
        #    --title,
        #    'Automaattinen sisällysluettelo / Automatically generated Table of Contents',
        #  ]
  # GitHub Actions etc. configuration validity checking
  - repo: https://github.com/python-jsonschema/check-jsonschema
    rev: 0.34.1
    hooks:
      #- id: check-jsonschema
      - id: check-dependabot
      - id: check-github-actions
      - id: check-github-workflows
      - id: check-gitlab-ci
      - id: check-renovate
        additional_dependencies: ["pyjson5"]
  # Easierish licensing when attempting reuse compliancy
  - repo: https://github.com/fsfe/reuse-tool
    rev: v6.2.0
    hooks:
      - id: reuse
  #  - repo: https://github.com/get-woke/woke
  #    rev: "v0.19.0"
  #    hooks:
  #      - id: woke-from-source
  - repo: local
    hooks:
      - id: prettier
        name: prettier
        entry: corepack npx prettier --cache --ignore-unknown --write
        language: system
  #      - id: alex
  #        name: alex
  #        entry: corepack npx alex --why --quiet
  #        language: system
  # .editorconfig validity checking
  - repo: https://github.com/editorconfig-checker/editorconfig-checker.python
    rev: "3.4.1"
    hooks:
      - id: editorconfig-checker
        alias: ec
        # I don't actually care about line lengths as more than a guideline
        args: [-disable-max-line-length]