-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
211 lines (193 loc) · 5.95 KB
/
Copy path.pre-commit-config.yaml
File metadata and controls
211 lines (193 loc) · 5.95 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
# Copyright (c) 2022 - 2026, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
default_install_hook_types: [pre-commit, commit-msg, pre-push]
default_stages: [pre-commit]
minimum_pre_commit_version: 4.0.0
repos:
# These meta hooks check the pre-commit configuration itself.
- repo: meta
hooks:
- id: check-hooks-apply
- id: check-useless-excludes
# Commitizen enforces semantic and conventional commit messages.
- repo: https://github.com/commitizen-tools/commitizen
rev: v4.13.9
hooks:
- id: commitizen
name: Check conventional commit message
stages: [commit-msg]
# Ruff formats and lints code.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.20
hooks:
- id: ruff-format
args: [--config, pyproject.toml]
- id: ruff-check
args: [--config, pyproject.toml, --fix, --unsafe-fixes, --exit-non-zero-on-fix]
# Check GitHub Actions workflow files.
- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.7.11.24
hooks:
- id: actionlint
# Check shell scripts with shellcheck.
- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.11.0.1
hooks:
- id: shellcheck
exclude: ^tests/
# Run Pylint from the local repo to make sure venv packages
# specified in pyproject.toml are available.
- repo: local
hooks:
- id: pylint
name: Check pylint issues
entry: pylint
language: python
files: ^src/macaron/|^tests/
exclude: ^tests/malware_analyzer/pypi/resources/sourcecode_samples.*
types: [text, python]
args: [--rcfile, pyproject.toml]
# Type-check all Python code.
- repo: local
hooks:
- id: mypy
name: Check typing annotations
entry: mypy
language: python
files: ^src/macaron/|^tests/
types: [text, python]
pass_filenames: false
args: [--show-traceback, --config-file, pyproject.toml]
# Enable a whole bunch of useful helper hooks, too.
# See https://pre-commit.com/hooks.html for more hooks.
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
stages: [pre-commit]
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
stages: [pre-commit]
exclude: ^tests/(.)*\.ambr$
- id: detect-private-key
- id: detect-aws-credentials
args: [--allow-missing-credentials]
- id: check-yaml
args: [--allow-multiple-documents]
- id: check-toml
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
# Disabling blanket-type-ignore for now until type stubs are added.
# - id: python-check-blanket-type-ignore
- id: python-check-mock-methods
- id: python-use-type-annotations
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char
# Check the reStructured Text files that make up
# this package's documentation.
# Commenting this out because https://github.com/Lucas-C/pre-commit-hooks-markup/issues/13
# - repo: https://github.com/Lucas-C/pre-commit-hooks-markup
# rev: v1.0.1
# hooks:
# - id: rst-linter
# Check and prettify the configuration files.
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.16.0
hooks:
- id: pretty-format-ini
args: [--autofix]
- id: pretty-format-yaml
args: [--autofix]
# Commenting this out because https://github.com/pappasam/toml-sort/issues/11
# - id: pretty-format-toml
# args: [--autofix]
- repo: local
hooks:
- id: integration-test-vet
name: validate integration test cases
entry: python
args:
- ./tests/integration/run.py
- vet
- ./tests/integration/cases/...
language: system
pass_filenames: false
# On push to the remote, run the unit tests.
- repo: local
hooks:
- id: pytest
name: Run unit tests
entry: |
python -W always::DeprecationWarning -m pytest -c pyproject.toml --cov-config pyproject.toml
src/macaron/ tests/ docs/
language: system
verbose: true
always_run: true
pass_filenames: false
stages: [pre-push]
# Checks the copyright header for .js, .py, and .java, etc. files.
- repo: local
hooks:
- id: copyright-checker
name: Copyright checker
entry: scripts/dev_scripts/copyright-checker.sh
language: system
always_run: true
pass_filenames: false
# Checks that tests/malware_analyzer/pypi/resources/sourcecode_samples files do not have executable permissions
# This is another measure to make sure the files can't be accidentally executed
- repo: local
hooks:
- id: sourcecode-sample-permissions
name: Sourcecode sample executable permissions checker
entry: scripts/dev_scripts/samples_permissions_checker.sh
language: system
always_run: true
pass_filenames: false
# A linter for Golang
- repo: https://github.com/golangci/golangci-lint
rev: v2.11.4
hooks:
- id: golangci-lint
# Other pre-commit hooks for golang:
# *-mod hooks run on the MODULE of each staged Go files.
# *-repo-mod hooks run on each MODULE in the repository. This allows us to add multiple go modules to this repo.
# *-repo hooks only run in the REPOSITORY root folder.
# These hooks automatically run on staged Go files, go.mod and go.sum.
# Other staged files shouldn't trigger these hooks.
# Documentation: https://github.com/TekWizely/pre-commit-golang/blob/v1.0.0-rc.1/README.md.
- repo: https://github.com/tekwizely/pre-commit-golang
rev: v1.0.0-rc.4
hooks:
- id: go-build-mod
- id: go-build-repo-mod
#
# Go Mod Tidy
#
- id: go-mod-tidy
- id: go-mod-tidy-repo
#
# Go Test
#
- id: go-test-mod
- id: go-test-repo-mod
#
# Go Vet
#
- id: go-vet-mod
- id: go-vet-repo-mod
#
# Go formatters
#
- id: go-fmt
- id: go-fmt-repo