.pre-commit-config.yaml 2.94 KB
Newer Older
1
# exclude files which are auto-generated by build tools
2
3
4
5
6
7
8
exclude: |
  (?x)^(
      build|
      external_libs|
      lightgbm-python|
      lightgbm_r|
  )$
9
10
11
12
  |R-package/configure$
  |R-package/inst/Makevars$
  |R-package/inst/Makevars.win$
  |R-package/man/.*Rd$
13
14

repos:
15
  - repo: https://github.com/pre-commit/pre-commit-hooks
16
    rev: v5.0.0
17
18
19
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace
20
21
22
23
  - repo: https://github.com/cmake-lint/cmake-lint
    rev: '1.4.3'
    hooks:
      - id: cmakelint
24
        args: ["--linelength=120"]
25
26
27
28
29
  - repo: https://github.com/cpplint/cpplint
    rev: '2.0.2'
    hooks:
      - id: cpplint
        args:
30
          - --root=..  # workaround to get correct header guard pattern
31
          - --recursive
32
          - --filter=-build/include_subdir,-whitespace/line_length
33
34
35
36
37
38
39
40
41
  - repo: local
    hooks:
      - id: check-omp-pragmas
        name: check-omp-pragmas
        entry: sh
        args:
          - .ci/check-omp-pragmas.sh
        language: system
        pass_filenames: false
42
  - repo: https://github.com/adrienverge/yamllint
43
    rev: v1.37.1
44
45
46
    hooks:
      - id: yamllint
        args: ["--strict"]
47
48
49
50
51
52
53
54
55
  - repo: local
    hooks:
      - id: regenerate-parameters
        name: regenerate-parameters
        entry: python
        args:
          - ./.ci/parameter-generator.py
        language: python
        pass_filenames: false
56
57
58
59
60
61
62
63
64
  - repo: https://github.com/rstcheck/rstcheck
    rev: v6.2.5
    hooks:
      - id: rstcheck
        args: ["--config", "./python-package/pyproject.toml"]
        additional_dependencies:
          - breathe>=4.36.0
          - sphinx>=8.1.3
          - sphinx_rtd_theme>=3.0.1
65
  - repo: https://github.com/astral-sh/ruff-pre-commit
66
    rev: v0.14.0
67
    hooks:
68
      - id: ruff-check
69
        args: ["--config", "python-package/pyproject.toml"]
70
        types_or: [python, jupyter]
71
72
      - id: ruff-format
        args: ["--config", "python-package/pyproject.toml"]
73
        types_or: [python, jupyter]
74
75
76
77
78
79
80
81
  - repo: https://github.com/biomejs/pre-commit
    rev: v2.2.5
    hooks:
      - id: biome-ci
        args:
          - --config-path=./biome.json
          - --diagnostic-level=info
          - --error-on-warnings
82
83
84
  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.10.0.1
    hooks:
85
86
      - id: shellcheck
  - repo: https://github.com/crate-ci/typos
87
    rev: v1.34.0
88
89
90
91
    hooks:
      - id: typos
        args: ["--force-exclude"]
        exclude: (\.gitignore$)|(^\.editorconfig$)
92
  - repo: https://github.com/henryiii/validate-pyproject-schema-store
93
    rev: 2025.07.14
94
95
96
    hooks:
      - id: validate-pyproject
        files: python-package/pyproject.toml$
97
98
99
100
101
102
103
104
105
106
  - repo: https://github.com/pre-commit/mirrors-mypy
    rev: v1.18.2
    hooks:
      - id: mypy
        verbose: true
        entry: bash -c 'mypy --config-file=./python-package/pyproject.toml ./python-package || true'
        additional_dependencies:
          - matplotlib>=3.9.1
          - pyarrow>=17.0
          - scikit-learn>=1.5.2