# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
#
# Install pre-commit itself:
#   $ pip install pre-commit
#     OR
#   $ brew install pre-commit
#
# Update all pre-commit hooks to latest version:
#   $ pre-commit autoupdate
#
# Install all pre-commit hooks locally:
#   $ pre-commit install
#
# Apply a given pre-commit hook to all files:
#   $ pre-commit run --all-files <id>
#
# Apply all pre-commit hooks to all files:
#   $ pre-commit run --all-files
repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: check-docstring-first
      - id: check-executables-have-shebangs
      - id: check-yaml
      - id: end-of-file-fixer
      - id: name-tests-test
        args: [--pytest-test-first]
      - id: requirements-txt-fixer
      - id: trailing-whitespace
  - repo: https://github.com/PyCQA/flake8.git
    rev: 6.0.0
    hooks:
      - id: flake8
  - repo: https://github.com/pre-commit/mirrors-eslint
    rev: v8.34.0
    hooks:
      - id: eslint
        files: \.[jt]s$
        types: [file]
  - repo: https://github.com/pre-commit/mirrors-prettier
    rev: v3.0.0-alpha.4
    hooks:
      - id: prettier
  - repo: https://github.com/google/yapf
    rev: v0.32.0
    hooks:
      - id: yapf
        args: ['--in-place', '--parallel']
  - repo: https://github.com/PyCQA/isort
    rev: 5.12.0
    hooks:
      - id: isort
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.2.0
    hooks:
      - id: mypy
        additional_dependencies: [types-requests]
  - repo: https://github.com/asottile/pyupgrade
    rev: v3.3.1
    hooks:
      - id: pyupgrade
        args: [--py310-plus]
  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.9.0.2
    hooks:
      - id: shellcheck
  - repo: https://github.com/codespell-project/codespell
    rev: 'v2.2.2'
    hooks:
      - id: codespell
        # skip false positives
        args: [--skip=package-lock.json, --skip=tests/test_screenshot.py]
  - repo: local
    hooks:
      - id: copyright
        name: check copyright
        entry: |-
          .* Copyright [0-9]+ Google LLC.
          .* Copyright \(c\) Microsoft Corporation.
          .*
          .* Licensed under the Apache License, Version 2.0 \(the "License"\);
          .* you may not use this file except in compliance with the License.
          .* You may obtain a copy of the License at
          .*
          .*     http://www.apache.org/licenses/LICENSE-2.0
          .*
          .* Unless required by applicable law or agreed to in writing, software
          .* distributed under the License is distributed on an "AS IS" BASIS,
          .* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
          .* See the License for the specific language governing permissions and
          .* limitations under the License.
        language: pygrep
        files: \.js$|\.cjs$|\.mjs$|\.ts$|\.py$
        args: [--negate, --multiline]
      - id: check-chai-describe-it-only
        name: check chai describe/it only
        entry: '\b(it|describe)\.only\('
        language: pygrep
        files: \.spec\.ts$
  - repo: https://github.com/google/keep-sorted
    rev: v0.1.1
    hooks:
      - id: keep-sorted
