Skip to content

Commit 065ba3e

Browse files
ci: add linter for markdown, yaml, CSS (deepmodeling#3574)
Signed-off-by: Jinzhe Zeng <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> (cherry picked from commit 145f501) Signed-off-by: Jinzhe Zeng <[email protected]>
1 parent 572050f commit 065ba3e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1408
-929
lines changed

.github/labeler.yml

+39-39
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
1-
Python:
2-
- changed-files:
3-
- any-glob-to-any-file:
4-
- deepmd/**/*
5-
- deepmd_utils/**/*
6-
- source/tests/**/*
7-
Docs:
8-
- changed-files:
9-
- any-glob-to-any-file: doc/**/*
10-
Examples:
11-
- changed-files:
12-
- any-glob-to-any-file: examples/**/*
13-
Core:
14-
- changed-files:
15-
- any-glob-to-any-file: source/lib/**/*
16-
CUDA:
17-
- changed-files:
18-
- any-glob-to-any-file: source/lib/src/gpu/**/*
19-
ROCM:
20-
- changed-files:
21-
- any-glob-to-any-file: source/lib/src/gpu/**/*
22-
OP:
23-
- changed-files:
24-
- any-glob-to-any-file: source/op/**/*
25-
C++:
26-
- changed-files:
27-
- any-glob-to-any-file: source/api_cc/**/*
28-
C:
29-
- changed-files:
30-
- any-glob-to-any-file: source/api_c/**/*
31-
LAMMPS:
32-
- changed-files:
33-
- any-glob-to-any-file: source/lmp/**/*
34-
Gromacs:
35-
- changed-files:
36-
- any-glob-to-any-file: source/gmx/**/*
37-
i-Pi:
38-
- changed-files:
39-
- any-glob-to-any-file: source/ipi/**/*
1+
Python:
2+
- changed-files:
3+
- any-glob-to-any-file:
4+
- deepmd/**/*
5+
- deepmd_utils/**/*
6+
- source/tests/**/*
7+
Docs:
8+
- changed-files:
9+
- any-glob-to-any-file: doc/**/*
10+
Examples:
11+
- changed-files:
12+
- any-glob-to-any-file: examples/**/*
13+
Core:
14+
- changed-files:
15+
- any-glob-to-any-file: source/lib/**/*
16+
CUDA:
17+
- changed-files:
18+
- any-glob-to-any-file: source/lib/src/gpu/**/*
19+
ROCM:
20+
- changed-files:
21+
- any-glob-to-any-file: source/lib/src/gpu/**/*
22+
OP:
23+
- changed-files:
24+
- any-glob-to-any-file: source/op/**/*
25+
C++:
26+
- changed-files:
27+
- any-glob-to-any-file: source/api_cc/**/*
28+
C:
29+
- changed-files:
30+
- any-glob-to-any-file: source/api_c/**/*
31+
LAMMPS:
32+
- changed-files:
33+
- any-glob-to-any-file: source/lmp/**/*
34+
Gromacs:
35+
- changed-files:
36+
- any-glob-to-any-file: source/gmx/**/*
37+
i-Pi:
38+
- changed-files:
39+
- any-glob-to-any-file: source/ipi/**/*

.pre-commit-config.yaml

+88-86
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,121 @@
11
# See https://pre-commit.com for more information
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
4-
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
55
rev: v4.5.0
66
hooks:
7-
- id: trailing-whitespace
7+
- id: trailing-whitespace
88
exclude: "^.+\\.pbtxt$"
9-
- id: end-of-file-fixer
9+
- id: end-of-file-fixer
1010
exclude: "^.+\\.pbtxt$"
11-
- id: check-yaml
12-
- id: check-json
13-
- id: check-added-large-files
14-
args: ['--maxkb=1024', '--enforce-all']
15-
# TODO: remove the following after resolved
11+
- id: check-yaml
12+
- id: check-json
13+
- id: check-added-large-files
14+
args: ["--maxkb=1024", "--enforce-all"]
1615
exclude: |
17-
(?x)^(
18-
source/tests/infer/dipolecharge_e.pbtxt|
19-
source/tests/infer/deeppolar_new.pbtxt
20-
)$
21-
- id: check-merge-conflict
22-
- id: check-symlinks
23-
- id: check-toml
24-
# Python
25-
- repo: https://github.com/PyCQA/isort
16+
(?x)^(
17+
source/tests/infer/dipolecharge_e.pbtxt|
18+
source/tests/infer/deeppolar_new.pbtxt
19+
)$
20+
- id: check-merge-conflict
21+
- id: check-symlinks
22+
- id: check-toml
23+
# Python
24+
- repo: https://github.com/PyCQA/isort
2625
rev: 5.13.2
2726
hooks:
28-
- id: isort
29-
files: \.py$
30-
exclude: ^source/3rdparty
31-
- repo: https://github.com/astral-sh/ruff-pre-commit
27+
- id: isort
28+
files: \.py$
29+
exclude: ^source/3rdparty
30+
- repo: https://github.com/astral-sh/ruff-pre-commit
3231
# Ruff version.
3332
rev: v0.3.3
3433
hooks:
35-
- id: ruff
36-
args: ["--fix"]
37-
exclude: ^source/3rdparty
38-
types_or: [python, pyi, jupyter]
39-
- id: ruff-format
40-
exclude: ^source/3rdparty
41-
types_or: [python, pyi, jupyter]
42-
# numpydoc
43-
- repo: https://github.com/Carreau/velin
34+
- id: ruff
35+
args: ["--fix"]
36+
exclude: ^source/3rdparty
37+
types_or: [python, pyi, jupyter]
38+
- id: ruff-format
39+
exclude: ^source/3rdparty
40+
types_or: [python, pyi, jupyter]
41+
# numpydoc
42+
- repo: https://github.com/Carreau/velin
4443
rev: 0.0.12
4544
hooks:
46-
- id: velin
47-
args: ["--write"]
48-
exclude: ^source/3rdparty
49-
# Python inside docs
50-
- repo: https://github.com/asottile/blacken-docs
45+
- id: velin
46+
args: ["--write"]
47+
exclude: ^source/3rdparty
48+
# Python inside docs
49+
- repo: https://github.com/asottile/blacken-docs
5150
rev: 1.16.0
5251
hooks:
53-
- id: blacken-docs
54-
# C++
55-
- repo: https://github.com/pre-commit/mirrors-clang-format
52+
- id: blacken-docs
53+
# C++
54+
- repo: https://github.com/pre-commit/mirrors-clang-format
5655
rev: v18.1.1
5756
hooks:
58-
- id: clang-format
57+
- id: clang-format
5958
exclude: ^source/3rdparty|source/lib/src/gpu/cudart/.+\.inc
60-
# CSS
61-
- repo: https://github.com/pre-commit/mirrors-csslint
62-
rev: v1.0.5
59+
# markdown, yaml, CSS, javascript
60+
- repo: https://github.com/pre-commit/mirrors-prettier
61+
rev: v4.0.0-alpha.8
62+
hooks:
63+
- id: prettier
64+
types_or: [markdown, yaml, css]
65+
# workflow files cannot be modified by pre-commit.ci
66+
exclude: ^(source/3rdparty|\.github/workflows|\.clang-format)
67+
# Shell
68+
- repo: https://github.com/scop/pre-commit-shfmt
69+
rev: v3.8.0-1
70+
hooks:
71+
- id: shfmt
72+
# CMake
73+
- repo: https://github.com/cheshirekow/cmake-format-precommit
74+
rev: v0.6.13
75+
hooks:
76+
- id: cmake-format
77+
#- id: cmake-lint
78+
# license header
79+
- repo: https://github.com/Lucas-C/pre-commit-hooks
80+
rev: v1.5.5
6381
hooks:
64-
- id: csslint
65-
# Shell
66-
- repo: https://github.com/scop/pre-commit-shfmt
67-
rev: v3.8.0-1
68-
hooks:
69-
- id: shfmt
70-
# CMake
71-
- repo: https://github.com/cheshirekow/cmake-format-precommit
72-
rev: v0.6.13
73-
hooks:
74-
- id: cmake-format
75-
#- id: cmake-lint
76-
# license header
77-
- repo: https://github.com/Lucas-C/pre-commit-hooks
78-
rev: v1.5.5
79-
hooks:
80-
# C++, js
81-
- id: insert-license
82+
# C++, js
83+
- id: insert-license
8284
files: \.(c|cc|cpp|js|ts|h|hpp)$
8385
args:
84-
- --license-filepath
85-
- .license-header.txt
86-
- --comment-style
87-
- //
88-
- --no-extra-eol
86+
- --license-filepath
87+
- .license-header.txt
88+
- --comment-style
89+
- //
90+
- --no-extra-eol
8991
exclude: ^source/3rdparty|source/lib/src/gpu/cudart/.+\.inc
90-
# CSS
91-
- id: insert-license
92+
# CSS
93+
- id: insert-license
9294
files: \.(css|scss)$
9395
args:
94-
- --license-filepath
95-
- .license-header.txt
96-
- --comment-style
97-
- /*| *| */
98-
- --no-extra-eol
99-
# Python
100-
- id: insert-license
96+
- --license-filepath
97+
- .license-header.txt
98+
- --comment-style
99+
- /*| *| */
100+
- --no-extra-eol
101+
# Python
102+
- id: insert-license
101103
files: \.(py|pyx)$
102104
args:
103-
- --license-filepath
104-
- .license-header.txt
105-
- --comment-style
106-
- "#"
107-
- --no-extra-eol
105+
- --license-filepath
106+
- .license-header.txt
107+
- --comment-style
108+
- "#"
109+
- --no-extra-eol
108110
exclude: ^source/3rdparty
109-
# HTML
110-
- id: insert-license
111+
# HTML
112+
- id: insert-license
111113
files: \.(html|vue|xml)$
112114
args:
113-
- --license-filepath
114-
- .license-header.txt
115-
- --comment-style
116-
- <!--| ~| -->
117-
- --no-extra-eol
115+
- --license-filepath
116+
- .license-header.txt
117+
- --comment-style
118+
- <!--| ~| -->
119+
- --no-extra-eol
118120
ci:
119121
autoupdate_branch: devel

0 commit comments

Comments
 (0)