.pre-commit-config.yaml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. # See https://pre-commit.com for more information
  5. # See https://pre-commit.com/hooks.html for more hooks
  6. default_language_version:
  7. python: python3 # Defaults to python2, so override it.
  8. repos:
  9. - repo: https://github.com/pre-commit/pre-commit-hooks
  10. rev: 6e2418c5521b7d606e72914dced3253f9ace1205 # frozen: v3.4.0
  11. hooks:
  12. - id: check-added-large-files
  13. - id: check-case-conflict
  14. - id: check-executables-have-shebangs
  15. - id: check-merge-conflict
  16. - id: check-symlinks
  17. exclude: '^website/jekyll/site/_includes$'
  18. - id: check-yaml
  19. - id: detect-private-key
  20. - id: end-of-file-fixer
  21. - id: mixed-line-ending
  22. args: ['--fix=lf']
  23. - id: trailing-whitespace
  24. exclude: '^(.*/testdata/.*\.golden)$'
  25. - repo: https://github.com/google/pre-commit-tool-hooks
  26. rev: 1d04a2848ac54d64bd6474ccec69aac45fa88414 # frozen: v1.1.1
  27. hooks:
  28. - id: check-copyright
  29. args:
  30. - --copyright
  31. - |+
  32. Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  33. Exceptions. See /LICENSE for license information.
  34. SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  35. - --custom_format
  36. - '\.6c$'
  37. - ''
  38. - '// '
  39. - ''
  40. - --custom_format
  41. - '\.lpp$'
  42. - '/*'
  43. - ''
  44. - '*/'
  45. - --custom_format
  46. - '\.ypp$'
  47. - ''
  48. - '// '
  49. - ''
  50. exclude: '^(website/(firebase/.firebaserc|jekyll/(Gemfile.lock|theme/.*))|.bazelversion|compile_flags.txt|.*\.def|.*/testdata/.*\.golden)$'
  51. - id: check-google-doc-style
  52. - id: markdown-toc
  53. - repo: https://github.com/codespell-project/codespell
  54. rev: 67c489d36dd4c52cbb9e4755d90c35c6231842ef # frozen: v2.0.0
  55. hooks:
  56. - id: codespell
  57. args: ['-I', '.codespell_ignore']
  58. exclude: '^website/jekyll/Gemfile.lock$'
  59. - repo: local
  60. hooks:
  61. - id: proposal-list
  62. name: Update list of proposals
  63. description: Updates the list of proposals in proposals/README.md
  64. entry: proposals/scripts/update_proposal_list.py
  65. language: python
  66. files: ^proposals/(README|p.*)\.md$
  67. pass_filenames: false
  68. # Formatters should be run late so that they can re-format any prior changes.
  69. - repo: https://github.com/psf/black
  70. rev: e66be67b9b6811913470f70c28b4d50f94d05b22 # frozen: 20.8b1
  71. hooks:
  72. - id: black
  73. - repo: https://github.com/jlebar/pre-commit-hooks.git
  74. rev: 349213c5414e360385e74f04964e6d5c43cdad36
  75. hooks:
  76. - id: bazel-buildifier
  77. - id: clang-format-whole-file
  78. types: [c++]
  79. - repo: https://github.com/pre-commit/mirrors-prettier
  80. rev: 8e0d199f4004a7f226ed7974fc3883d9c702bded # frozen: v2.2.1
  81. hooks:
  82. - id: prettier
  83. exclude: ^website/jekyll/theme/
  84. # Run linters last, as formatters and other checks may fix issues.
  85. - repo: https://gitlab.com/PyCQA/flake8
  86. rev: bb6a530e28acab8d3551043b3e8709db8bcbac6b # frozen: 3.8.4
  87. hooks:
  88. - id: flake8
  89. # We fully exclude fuzzer corpus directories as they are generated binary data.
  90. exclude: '^(.*/fuzzer_corpus/.*)$'