.pre-commit-config.yaml 2.52 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
24
  - repo: https://github.com/cmake-lint/cmake-lint
    rev: '1.4.3'
    hooks:
      - id: cmakelint
        args: ["--linelength=120", "--filter=-convention/filename,-package/stdargs,-readability/wonkycase"]
25
26
27
28
29
30
  - repo: https://github.com/cpplint/cpplint
    rev: '2.0.2'
    hooks:
      - id: cpplint
        args:
          - --recursive
31
          - --filter=-build/include_subdir,-build/header_guard,-whitespace/indent_namespace,-whitespace/line_length
32
33
34
35
36
37
38
39
40
  - repo: local
    hooks:
      - id: check-omp-pragmas
        name: check-omp-pragmas
        entry: sh
        args:
          - .ci/check-omp-pragmas.sh
        language: system
        pass_filenames: false
41
  - repo: https://github.com/adrienverge/yamllint
42
    rev: v1.37.1
43
44
45
    hooks:
      - id: yamllint
        args: ["--strict"]
46
47
48
49
50
51
52
53
54
  - repo: local
    hooks:
      - id: regenerate-parameters
        name: regenerate-parameters
        entry: python
        args:
          - ./.ci/parameter-generator.py
        language: python
        pass_filenames: false
55
56
57
58
59
60
61
62
63
  - 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
64
65
  - repo: https://github.com/astral-sh/ruff-pre-commit
    # Ruff version.
66
    rev: v0.14.0
67
68
    hooks:
      # Run the linter.
69
      - id: ruff-check
70
        args: ["--config", "python-package/pyproject.toml"]
71
        types_or: [python, jupyter]
72
73
74
      # Run the formatter.
      - id: ruff-format
        args: ["--config", "python-package/pyproject.toml"]
75
        types_or: [python, jupyter]
76
77
78
  - repo: https://github.com/shellcheck-py/shellcheck-py
    rev: v0.10.0.1
    hooks:
79
80
      - id: shellcheck
  - repo: https://github.com/crate-ci/typos
81
    rev: v1.34.0
82
83
84
85
    hooks:
      - id: typos
        args: ["--force-exclude"]
        exclude: (\.gitignore$)|(^\.editorconfig$)
86
  - repo: https://github.com/henryiii/validate-pyproject-schema-store
87
    rev: 2025.07.14
88
89
90
    hooks:
      - id: validate-pyproject
        files: python-package/pyproject.toml$