-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path.pre-commit-config.yaml
More file actions
151 lines (140 loc) · 4.15 KB
/
.pre-commit-config.yaml
File metadata and controls
151 lines (140 loc) · 4.15 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
# Copyright 2026 Two Sigma Open Source, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
repos:
# Python - Ruff linter and formatter
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.4
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
# Python - Type checking with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.14.1
hooks:
- id: mypy
additional_dependencies: [pytest, cocotb]
args: [--config-file=pyproject.toml]
pass_filenames: false
entry: mypy verif tests
# C/C++ - clang-format
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.6
hooks:
- id: clang-format
types_or: [c, c++]
exclude: |
(?x)^(
sw/FreeRTOS-Kernel/.*|
sw/apps/coremark/coremark/.*|
sw/apps/riscv_tests/riscv_test\.h
)$
# C/C++ - clang-tidy (uses wrapper script to set RISC-V target and include paths)
- repo: local
hooks:
- id: clang-tidy
name: clang-tidy
entry: python3 ./scripts/run-clang-tidy.py
language: system
types_or: [c, c++]
exclude: |
(?x)^(
sw/FreeRTOS-Kernel/.*|
sw/apps/coremark/coremark/.*|
sw/apps/riscv_tests/riscv_test\.h
)$
# SystemVerilog/Verilog - Verible formatter and linter
- repo: local
hooks:
- id: verible-format
name: verible-verilog-format
entry: verible-verilog-format
language: system
files: \.(sv|v|svh|vh)$
args: [--inplace]
exclude: |
(?x)^(
hw/third_party/.*
)$
- id: verible-lint
name: verible-verilog-lint
entry: verible-verilog-lint
language: system
files: \.(sv|v|svh|vh)$
args: [--rules_config_search]
exclude: |
(?x)^(
hw/third_party/.*
)$
# Copyright header check/insert
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.5
hooks:
- id: insert-license
name: insert-license (Python)
files: \.py$
exclude: |
(?x)^(
sw/FreeRTOS-Kernel/.*|
sw/apps/coremark/coremark/.*
)$
args:
- --license-filepath=.license-header.txt
- --comment-style=#
- id: insert-license
name: insert-license (C/C++)
files: \.(c|h|cpp|hpp)$
exclude: |
(?x)^(
sw/FreeRTOS-Kernel/.*|
sw/apps/coremark/coremark/.*|
sw/apps/riscv_tests/riscv_test\.h
)$
args:
- --license-filepath=.license-header.txt
- --comment-style=/*| *| */
- id: insert-license
name: insert-license (SystemVerilog)
files: \.(sv|svh|v|vh)$
exclude: |
(?x)^(
hw/third_party/.*
)$
args:
- --license-filepath=.license-header.txt
- --comment-style=/*| *| */
- id: insert-license
name: insert-license (Tcl/Makefile/Shell)
files: (\.tcl$|Makefile$|\.mk$|\.sh$)
args:
- --license-filepath=.license-header.txt
- --comment-style=#
# General file checks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: trailing-whitespace
exclude: |
(?x)^(
sw/FreeRTOS-Kernel/.*|
sw/apps/coremark/coremark/.*
)$
- id: end-of-file-fixer
exclude: |
(?x)^(
sw/FreeRTOS-Kernel/.*|
sw/apps/coremark/coremark/.*
)$
- id: check-yaml
- id: check-added-large-files