Skip to content

Commit 2a59098

Browse files
committed
style: format pre-commit check
Signed-off-by: sirutBuasai <sirutbuasai27@outlook.com>
1 parent c6eb798 commit 2a59098

File tree

1 file changed

+85
-79
lines changed

1 file changed

+85
-79
lines changed

.pre-commit-config.yaml

Lines changed: 85 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -16,122 +16,128 @@ repos:
1616
rev: v6.0.0
1717
hooks:
1818
# ------------------------------- 🌳 Git Tools ------------------------------- #
19-
- id: check-merge-conflict
20-
name: "🌳 git · Detect conflict markers"
21-
- id: forbid-new-submodules
22-
name: "🌳 git · Prevent submodule creation"
23-
- id: no-commit-to-branch
24-
name: "🌳 git · Protect main branches"
25-
args: ["--branch", "main", "--branch", "master"]
26-
- id: check-added-large-files
27-
name: "🌳 git · Block large file commits"
28-
args: ["--maxkb=5000"]
19+
- id: check-merge-conflict
20+
name: "🌳 git · Detect conflict markers"
21+
- id: forbid-new-submodules
22+
name: "🌳 git · Prevent submodule creation"
23+
- id: no-commit-to-branch
24+
name: "🌳 git · Protect main branches"
25+
args: ["--branch", "main", "--branch", "master"]
26+
- id: check-added-large-files
27+
name: "🌳 git · Block large file commits"
28+
args: ["--maxkb=5000"]
2929
# ---------------------------- 📁 Filesystem Tools --------------------------- #
30-
- id: check-executables-have-shebangs
31-
name: "📁 filesystem/⚙️ exec · Verify shebang presence"
32-
- id: check-shebang-scripts-are-executable
33-
name: "📁 filesystem/⚙️ exec · Verify script permissions"
34-
- id: check-symlinks
35-
name: "📁 filesystem/🔗 symlink · Check symlink validity"
36-
- id: destroyed-symlinks
37-
name: "📁 filesystem/🔗 symlink · Detect broken symlinks"
38-
- id: requirements-txt-fixer
39-
name: "📁 filesystem/📝 file · Validate requirements.txt"
40-
- id: trailing-whitespace
41-
name: "📁 filesystem/📝 file · Validate empty whitespaces"
30+
- id: check-executables-have-shebangs
31+
name: "📁 filesystem/⚙️ exec · Verify shebang presence"
32+
- id: check-shebang-scripts-are-executable
33+
name: "📁 filesystem/⚙️ exec · Verify script permissions"
34+
- id: check-symlinks
35+
name: "📁 filesystem/🔗 symlink · Check symlink validity"
36+
- id: destroyed-symlinks
37+
name: "📁 filesystem/🔗 symlink · Detect broken symlinks"
38+
- id: requirements-txt-fixer
39+
name: "📁 filesystem/📝 file · Validate requirements.txt"
40+
- id: trailing-whitespace
41+
name: "📁 filesystem/📝 file · Validate empty whitespaces"
4242
# ----------------------------- 🔒 Security Tools ---------------------------- #
43-
- id: check-json
44-
name: "📁 filesystem/🔧 config · Validate JSON file"
45-
- id: check-yaml
46-
name: "📁 filesystem/🔧 config · Validate YAML file"
47-
- id: detect-aws-credentials
48-
name: "🔒 security · Detect aws credentials"
49-
args:
50-
- --allow-missing-credentials
51-
- id: detect-private-key
52-
name: "🔒 security · Detect private kayes"
43+
- id: check-json
44+
name: "📁 filesystem/🔧 config · Validate JSON file"
45+
- id: check-yaml
46+
name: "📁 filesystem/🔧 config · Validate YAML file"
47+
- id: detect-aws-credentials
48+
name: "🔒 security · Detect aws credentials"
49+
args:
50+
- --allow-missing-credentials
51+
- id: detect-private-key
52+
name: "🔒 security · Detect private kayes"
5353

5454

5555
- repo: https://github.com/gitleaks/gitleaks
5656
rev: v8.29.0
5757
hooks:
58-
- id: gitleaks
59-
name: "🔒 security · Detect hardcoded secrets"
58+
- id: gitleaks
59+
name: "🔒 security · Detect hardcoded secrets"
6060

6161
# --------------------------- 🔍 Code Quality Tools -------------------------- #
6262

6363
### Writing Tools ###
6464
- repo: https://github.com/crate-ci/typos
6565
rev: v1.38.1
6666
hooks:
67-
- id: typos
68-
name: "✏️ typos · Checking typos"
69-
args: [--force-exclude]
67+
- id: typos
68+
name: "✏️ typos · Checking typos"
69+
args: [--force-exclude]
7070

7171

7272
### Python Tools ###
7373
- repo: https://github.com/astral-sh/ruff-pre-commit
7474
rev: v0.14.3
7575
hooks:
76-
- id: ruff-format
77-
name: "🐍 python · Format python"
78-
- id: ruff-check
79-
name: "🐍 python · Lint python"
76+
- id: ruff-format
77+
name: "🐍 python · Format python"
78+
- id: ruff-check
79+
name: "🐍 python · Lint python"
80+
81+
- repo: https://github.com/pycqa/isort
82+
rev: 7.0.0
83+
hooks:
84+
- id: isort
85+
name: "🐍 python · Sort python packages"
8086

8187

8288
### Workflow Validation ###
8389
- repo: https://github.com/python-jsonschema/check-jsonschema
8490
rev: 0.35.0
8591
hooks:
86-
- id: check-github-workflows
87-
name: "🐙 github-actions · Validate gh workflow files"
88-
args: ["--verbose"]
92+
- id: check-github-workflows
93+
name: "🐙 github-actions · Validate gh workflow files"
94+
args: ["--verbose"]
8995

9096
- repo: https://github.com/rhysd/actionlint
9197
rev: v1.7.8
9298
hooks:
93-
- id: actionlint
94-
name: "🐙 github-actions · Lint gh workflow files"
95-
args: ["-shellcheck=enable=all"]
99+
- id: actionlint
100+
name: "🐙 github-actions · Lint gh workflow files"
101+
args: ["-shellcheck=enable=all"]
96102

97103

98104
### Markdown ###
99105
- repo: https://github.com/hukkin/mdformat
100106
rev: 1.0.0
101107
hooks:
102-
- id: mdformat
103-
name: "📝 markdown · Format markdown"
104-
additional_dependencies:
105-
- mdformat-gfm
106-
- mdformat-ruff
107-
- ruff
108+
- id: mdformat
109+
name: "📝 markdown · Format markdown"
110+
additional_dependencies:
111+
- mdformat-gfm
112+
- mdformat-ruff
113+
- ruff
108114

109115
- repo: https://github.com/igorshubovych/markdownlint-cli
110116
rev: v0.45.0
111117
hooks:
112-
- id: markdownlint
113-
name: "📝 markdown · Lint markdown"
114-
args: [--fix]
118+
- id: markdownlint
119+
name: "📝 markdown · Lint markdown"
120+
args: [--fix]
115121

116122

117123
### Docker Tools ###
118124
- repo: https://github.com/reteps/dockerfmt
119125
rev: v0.3.9
120126
hooks:
121-
- id: dockerfmt
122-
name: "🐳 docker · Format docker"
123-
args:
124-
- --indent=2
125-
- --write
127+
- id: dockerfmt
128+
name: "🐳 docker · Format docker"
129+
args:
130+
- --indent=2
131+
- --write
126132

127133

128134
### Shell ###
129135
- repo: https://github.com/scop/pre-commit-shfmt
130136
rev: v3.12.0-2 # Use the latest stable revision
131137
hooks:
132-
- id: shfmt
133-
name: "🐚 shell · Format shell scripts"
134-
args: ["-s"]
138+
- id: shfmt
139+
name: "🐚 shell · Format shell scripts"
140+
args: ["-s"]
135141

136142

137143
# --------------------------- ✍️ Git Commit Quality -------------------------- #
@@ -140,21 +146,21 @@ repos:
140146
- repo: https://github.com/commitizen-tools/commitizen
141147
rev: v4.1.0
142148
hooks:
143-
- id: commitizen
144-
name: "🌳 git · Validate commit message"
145-
additional_dependencies: [cz-conventional-gitmoji]
149+
- id: commitizen
150+
name: "🌳 git · Validate commit message"
151+
additional_dependencies: [cz-conventional-gitmoji]
146152

147153
- repo: local
148154
hooks:
149-
- id: signoff-commit
150-
name: Sign-off Commit
151-
entry: bash
152-
args:
153-
- -c
154-
- |
155-
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
156-
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
157-
fi
158-
language: system
159-
verbose: true
160-
stages: [commit-msg]
155+
- id: signoff-commit
156+
name: Sign-off Commit
157+
entry: bash
158+
args:
159+
- -c
160+
- |
161+
if ! grep -q "^Signed-off-by: $(git config user.name) <$(git config user.email)>" "$(git rev-parse --git-path COMMIT_EDITMSG)"; then
162+
printf "\nSigned-off-by: $(git config user.name) <$(git config user.email)>\n" >> "$(git rev-parse --git-path COMMIT_EDITMSG)"
163+
fi
164+
language: system
165+
verbose: true
166+
stages: [commit-msg]

0 commit comments

Comments
 (0)