Files
carbon-lang/.pre-commit-config.yaml
T
2021-05-17 08:15:07 -07:00

112 lines
3.7 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
# 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: 6e2418c5521b7d606e72914dced3253f9ace1205 # frozen: v3.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
exclude: |
(?x)^(
website/jekyll/site/_includes|
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: 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$'
- ''
- '// '
- ''
exclude: |
(?x)^(
.bazelversion|
compile_flags.txt|
third_party/examples/.*/compile_flags.carbon.txt|
website/(firebase/.firebaserc|jekyll/(Gemfile.lock|theme/.*))|
.*\.def|
.*/testdata/.*\.golden
)$
- id: check-google-doc-style
- id: markdown-toc
- repo: https://github.com/codespell-project/codespell
rev: 67c489d36dd4c52cbb9e4755d90c35c6231842ef # frozen: v2.0.0
hooks:
- id: codespell
args: ['-I', '.codespell_ignore']
exclude: '^website/jekyll/Gemfile.lock$'
- repo: local
hooks:
- id: proposal-list
name: Update list of proposals
description: Updates the list of proposals in proposals/README.md
entry: proposals/scripts/update_proposal_list.py
language: python
files: ^proposals/(README|p.*)\.md$
pass_filenames: false
# Formatters should be run late so that they can re-format any prior changes.
- repo: https://github.com/psf/black
rev: e66be67b9b6811913470f70c28b4d50f94d05b22 # frozen: 20.8b1
hooks:
- id: black
- repo: https://github.com/jlebar/pre-commit-hooks.git
rev: 07a539b8db43298f124ace23c90b4b871911b8c4
hooks:
- id: bazel-buildifier
- id: clang-format-whole-file
types: [c++]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: 8e0d199f4004a7f226ed7974fc3883d9c702bded # frozen: v2.2.1
hooks:
- id: prettier
exclude: ^website/jekyll/theme/
# Run linters last, as formatters and other checks may fix issues.
- repo: https://gitlab.com/PyCQA/flake8
rev: 56370aae451722f9d77a5ccd6fb6e231a4a8e651 # frozen: 3.9.0
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/.*
)$