-
Notifications
You must be signed in to change notification settings - Fork 35
/
.pre-commit-config.yaml
104 lines (96 loc) · 3.36 KB
/
.pre-commit-config.yaml
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
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
default_stages: [commit]
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
# general checks
- id: check-xml
- id: check-yaml
- id: check-json
exclude: '.babelrc'
- id: check-merge-conflict
fail_fast: true
# other checks
- id: check-docstring-first
exclude: |
(?x)^(
Allura/allura/eventslistener.py|
Allura/allura/lib/.*|
)$
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-backticks
exclude:
(?x)^(
Allura/docs/.*|
ForgeImporters/docs/.*
)$
- id: rst-directive-colons
- id: rst-inline-touching-normal
# https://pre-commit.com/#pygrep
# mirrors test_syntax.py tests. TODO have test_syntax.py run `pre-commit run --all-files utcnow` etc
- repo: local
hooks:
# Use
# .utcnow() rather than .now()
# .utcfromtimestamp() rather than .fromtimestamp()
# calendar.timegm() rather than mktime()
- id: tz-functions
name: don't use local tz functions
language: pygrep
types: [python]
entry: '\.now\(|\.fromtimestamp\(|\.mktime\('
# SCSS Syntax: could use placeholders instead of extending a class or tag directly
- id: scss_extend_pattern
name: search for scss invalid extend patterns in class elements
language: pygrep
types: [file, scss]
entry: '@extend [^%]((?![\/\/]\stest_scss_extend_pattern allow).)*$'
exclude: 'node_modules'
- repo: https://github.com/aristanetworks/j2lint
rev: f291b271118c524b9ecb0bb5df9f846345963469 # latest as of June 2024
hooks:
- id: j2lint
types: [html]
args:
- --extensions
- html
# only check jinja-syntax-error and jinja-statements-no-tabs
- --ignore
- single-space-decorator
- operator-enclosed-by-spaces
- jinja-statements-indentation
- jinja-statements-single-space
- jinja-statements-delimiter
- single-statement-per-line
- jinja-variable-lower-case
- jinja-variable-format
- --
- repo: https://github.com/milin/giticket
rev: v1.4
hooks:
- id: giticket
args: ['--mode=regex_match', '--format=[#{ticket}] {commit_msg}', '--regex=[0-9]{4,}']
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.5.5
hooks:
- id: ruff
types: [python]