Files
carbon-lang/.pre-commit-config.yaml
T
Jon Meow 309ec35f95 Rename executable_semantics to explorer (#1188)
Change generated with:

```
#!/usr/bin/bash -eux

# Helper script for renaming pending work.
# Run from the repo root.

# Rename executable_semantics in code.
sed -i 's/executable_semantics/explorer/g' \
  $(git grep -l 'executable_semantics' . | grep -v proposals)
sed -i 's/executable semantics/explorer/g' \
  $(git grep -l 'executable semantics' . | grep -v proposals)
sed -i 's/Executable semantics/Explorer/g' \
  $(git grep -l 'Executable semantics' . |  grep -v proposals)
sed -i 's/Executable Semantics/Explorer/g' \
  $(git grep -l 'Executable Semantics' . |  grep -v proposals)
sed -i 's/EXECUTABLE_SEMANTICS/EXPLORER/g' \
  $(git grep -l 'EXECUTABLE_SEMANTICS' . | grep -v proposals)
sed -i 's/ExecutableSemantics/Explorer/g' \
  $(git grep -l 'ExecutableSemantics' . | grep -v proposals)
sed -i 's/executable-semantics/explorer/g' \
  $(git grep -l 'executable-semantics' . | grep -v proposals)

# This is only needed for the initial move.
mv executable_semantics explorer
mv explorer/fuzzing/executable_semantics_fuzzer.cpp explorer/fuzzing/explorer_fuzzer.cpp
```

Verified with `bazel test ...`
2022-04-29 13:20:25 -07:00

132 lines
4.3 KiB
YAML

# 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 && pre-commit run -a
# 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: 8fe62d14e0b4d7d845a7022c5c2c3ae41bdd3f26 # frozen: v4.1.0
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/google/pre-commit-tool-hooks
rev: cb78d9293306d9f737c64d9702bbaa88e157caaa # frozen: v1.2.2
hooks:
- id: check-google-doc-style
- id: markdown-toc
- repo: local
hooks:
- id: fix-cc-deps
name: Fix missing C++ deps
entry: scripts/fix_cc_deps.py
language: python
files: ^.*/(BUILD|[^/]+\.(h|cpp))$
pass_filenames: false
# Formatters should be run late so that they can re-format any prior changes.
- repo: https://github.com/psf/black
rev: ae2c0758c9e61a385df9700dc9c231bf54887041 # frozen: 22.3.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 5e374fda194d7f7ce9eebbd582b2a5594838c85b # frozen: v2.6.2
hooks:
- id: prettier
- repo: local
hooks:
- id: buildifier
name: Bazel buildifier
entry: scripts/run_buildifier.py
language: python
files: '^(.*/)?(BUILD\.bazel|BUILD|WORKSPACE)$|\.BUILD$|\.bzl$'
- id: explorer-format-grammar
name: Format the explorer grammar file
entry: explorer/syntax/format_grammar.py
language: python
files: ^explorer/syntax/(lexer.lpp|parser.ypp)$
pass_filenames: false
additional_dependencies: ['clang-format==13.0.1']
- id: clang-format
name: clang-format
entry: clang-format
types_or: [c++, proto]
language: python
args: ['-i']
additional_dependencies: ['clang-format==13.0.1']
# Run linters last, as formatters and other checks may fix issues.
- repo: local
hooks:
- id: forbid-llvm-googletest
name: Checks for deps on LLVM's version of GoogleTest
entry: scripts/forbid_llvm_googletest.py
language: python
files: ^.*/BUILD$
pass_filenames: false
- repo: https://github.com/PyCQA/flake8
rev: cbeb4c9c4137cff1568659fcc48e8b85cddd0c8d # frozen: 4.0.1
hooks:
- id: flake8
- 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: https://github.com/google/pre-commit-tool-hooks
rev: cb78d9293306d9f737c64d9702bbaa88e157caaa # frozen: v1.2.2
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|proto|ypp)$'
- ''
- '// '
- ''
- --custom_format
- '\.(l|lpp|y)$'
- '/*'
- ''
- '*/'
exclude: |
(?x)^(
.bazelversion|
compile_flags.txt|
third_party/.*|
.*\.def|
.*\.svg|
.*/testdata/.*\.golden
)$
- id: check-links
# 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/.*|
third_party/llvm-project/.*|
.*/fuzzer_corpus/.*
)$