| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- # Exceptions. See /LICENSE for license information.
- # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- # Update versions with:
- # pre-commit autoupdate --freeze
- # See https://pre-commit.com for more information
- # See https://pre-commit.com/hooks.html for more hooks
- default_language_version:
- python: python3 # Defaults to python2, so override it.
- repos:
- - repo: https://github.com/pre-commit/pre-commit-hooks
- rev: 38b88246ccc552bffaaf54259d064beeee434539 # frozen: v4.0.1
- hooks:
- - id: check-added-large-files
- - id: check-case-conflict
- - id: check-executables-have-shebangs
- - id: check-merge-conflict
- - id: check-symlinks
- exclude: ^bazel-(clang-toolchain|execroot)$
- - id: check-yaml
- - id: detect-private-key
- - id: end-of-file-fixer
- - id: mixed-line-ending
- args: ['--fix=lf']
- - id: trailing-whitespace
- exclude: '^(.*/testdata/.*\.golden)$'
- - repo: https://github.com/mattlqx/pre-commit-search-and-replace
- rev: 417c99dafb534d7517d9abc17f0293de3c915a72 # frozen: v1.0.5
- hooks:
- - id: search-and-replace
- files: '\.md$'
- - repo: https://github.com/google/pre-commit-tool-hooks
- rev: 1d04a2848ac54d64bd6474ccec69aac45fa88414 # frozen: v1.1.1
- hooks:
- - id: check-copyright
- args:
- - --copyright
- - |+
- Part of the Carbon Language project, under the Apache License v2.0 with LLVM
- Exceptions. See /LICENSE for license information.
- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- - --custom_format
- - '\.carbon$'
- - ''
- - '// '
- - ''
- - --custom_format
- - '\.lpp$'
- - '/*'
- - ''
- - '*/'
- - --custom_format
- - '\.ypp$'
- - ''
- - '// '
- - ''
- - --custom_format
- - '\.l$'
- - '/*'
- - ''
- - '*/'
- - --custom_format
- - '\.y$'
- - '/*'
- - ''
- - '*/'
- exclude: |
- (?x)^(
- .bazelversion|
- compile_flags.txt|
- third_party/examples/.*/compile_flags.carbon.txt|
- .*\.def|
- .*\.svg|
- .*/testdata/.*\.golden
- )$
- - id: check-google-doc-style
- - id: markdown-toc
- - repo: https://github.com/codespell-project/codespell
- rev: 01da43d753cdff4ea7dff952b4f5317450af31e3 # frozen: v2.1.0
- hooks:
- - id: codespell
- args: ['-I', '.codespell_ignore', '--uri-ignore-words-list', '*']
- - repo: local
- hooks:
- - id: executable-semantics-format-grammar
- name: Format the executable_semantics grammar file
- entry: executable_semantics/syntax/format_grammar.py
- language: python
- files: ^executable_semantics/syntax/(lexer.lpp|parser.ypp)$
- pass_filenames: false
- # Formatters should be run late so that they can re-format any prior changes.
- - repo: https://github.com/psf/black
- rev: 911470a610e47d9da5ea938b0887c3df62819b85 # frozen: 21.9b0
- hooks:
- - id: black
- - repo: https://github.com/jlebar/pre-commit-hooks.git
- rev: fb5e481f35f5a9b32a06ccfc28b8d6dda4525f75
- hooks:
- - id: bazel-buildifier
- - id: clang-format-whole-file
- types: [c++]
- - repo: https://github.com/pre-commit/mirrors-prettier
- rev: 6e24ff01ab7d5e64045599b81c4cd34d6a6a7159 # frozen: v2.4.1
- hooks:
- - id: prettier
- # Run linters last, as formatters and other checks may fix issues.
- - repo: https://github.com/PyCQA/flake8
- rev: cbeb4c9c4137cff1568659fcc48e8b85cddd0c8d # frozen: 4.0.1
- hooks:
- - id: flake8
- # Most third-party code is in submodules; local commits are excluded here.
- # We fully exclude fuzzer corpus directories as they are generated binary data.
- exclude: |
- (?x)^(
- third_party/examples/.*/carbon/.*|
- .*/fuzzer_corpus/.*
- )$
|