# 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 default pre-commit hooks locally: # $ pre-commit install # # Install commit-msg hooks locally (e.g. for conventional commits): # $ pre-commit install --hook-types commit-msg # # Apply a given pre-commit hook to all files: # $ pre-commit run --all-files # # Apply all pre-commit hooks to all files: # $ pre-commit run --all-files default_stages: [pre-push, manual] repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v6.0.0 hooks: - id: check-docstring-first - id: check-executables-have-shebangs - id: check-yaml - id: end-of-file-fixer exclude: | (?x)^( .browser| .nvmrc )$ - id: name-tests-test args: [--pytest-test-first] exclude: tests/tools/.* - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/compilerla/conventional-pre-commit rev: v4.3.0 hooks: # Most common ones: [build, chore, ci, docs, feat, fix, refactor, test] # https://conventionalcommits.org - id: conventional-pre-commit stages: [commit-msg] - repo: https://github.com/PyCQA/flake8.git rev: 7.3.0 hooks: - id: flake8 - repo: https://github.com/google/yapf # Use v0.31.0 to match the version in Chromium depot_tools: https://chromium.googlesource.com/chromium/tools/depot_tools.git # XXX: Upgrade to v0.32.0 when upstream is addressed: https://bugs.chromium.org/p/chromium/issues/detail?id=1420681 # Otherwise formatting is inconsistent, e.g. https://github.com/GoogleChromeLabs/chromium-bidi/issues/889 rev: v0.43.0 hooks: - id: yapf args: [--in-place, --parallel] - repo: https://github.com/PyCQA/isort rev: 7.0.0 hooks: - id: isort - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.19.1 hooks: - id: mypy additional_dependencies: [types-requests] - repo: https://github.com/asottile/pyupgrade rev: v3.21.2 hooks: - id: pyupgrade args: [--py310-plus] - repo: https://github.com/PyCQA/bandit rev: 1.9.2 hooks: - id: bandit args: [--ini, .bandit] - repo: https://github.com/shellcheck-py/shellcheck-py rev: v0.11.0.1 hooks: - id: shellcheck - repo: https://github.com/codespell-project/codespell rev: v2.4.1 hooks: - id: codespell # skip false positives args: [ --skip=package-lock.json, --skip=tests/screenshot/test_screenshot.py, --skip=*.py.ini, -L=thirdParty, ] exclude_types: [pem] - repo: https://github.com/google/keep-sorted rev: v0.7.1 hooks: - id: keep-sorted - 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 types_or: [javascript, ts, python] exclude: __init__\.py$ args: [--negate, --multiline] - id: node-self name: check nodejs `self.` entry: '\bself\.' language: pygrep types_or: [ts] # ESLint is the slowest hook, so keep it at the bottom. - id: eslint name: eslint entry: 'npm run format:eslint' language: system verbose: true pass_filenames: false # ESLint may update code style (formatting) so keep prettier last. - id: prettier name: prettier entry: 'npm run format:prettier' language: system pass_filenames: false