.pre-commit-config.yaml 1.67 KB
Newer Older
yongshk's avatar
yongshk committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks

# This file defines what runs automatically before `git commit`
repos:
  # ============================================================
  # 1. Official pre-commit hooks (safety & hygiene)
  #
  # These hooks are:
  # - extremely fast
  # - non-controversial
  # - designed to prevent costly mistakes
  # ============================================================
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      # Prevent committing unresolved merge conflicts
      - id: check-merge-conflict

      # Remove trailing whitespace
      - id: trailing-whitespace

      # Ensure files end with a newline (POSIX requirement)
      - id: end-of-file-fixer

      # Prevent accidentally committing large files
      # (model checkpoints, logs, datasets, etc.)
      - id: check-added-large-files
        args:
          - "--maxkb=10240"

      # Attempts to load all yaml files to verify syntax.
      - id: check-yaml
      # 排除 detectron2 使用了 pyyaml 语法的 yaml 文件
        exclude: |
          (?x)(
              ^common/base/autodrive/3rdparty/detectron2/configs/Base-RetinaNet\.yaml$ |
              ^common/base/autodrive/3rdparty/detectron2/projects/Panoptic-DeepLab/configs/COCO-PanopticSegmentation/panoptic_deeplab_R_52_os16_mg124_poly_200k_bs64_crop_640_640_coco_dsconv\.yaml$
          )

      # Attempts to load all json files to verify syntax.
      - id: check-json

      # Attempts to load all TOML files to verify syntax.
      - id: check-toml

      # Checks for symlinks which do not point to anything.
      - id: check-symlinks