forked from onetimesecret/onetimesecret
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pre-commit-config.yaml
104 lines (95 loc) · 2.87 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
##
# Pre-Commit Configuration
#
# Initial setup:
#
# 0. Install the pre-commit framework (if it isn't already on your system):
#
# $ pip install pre-commit
#
# 1. Install the git hook:
#
# $ pre-commit install
#
#
# Other commands:
#
# Run it on all the files in this repo:
# $ pre-commit run --all-files
#
# Updating plugin repositories:
# $ pre-commit autoupdate
#
# Automatically enable pre-commit on repositories
# $ git config --global init.templateDir ~/.git-template
# $ pre-commit init-templatedir ~/.git-template
#
# See also:
# - https://pre-commit.com for more information
# - https://pre-commit.com/hooks.html for more hooks
#
default_install_hook_types:
- pre-commit
- prepare-commit-msg
- post-commit
- post-checkout
- post-merge
fail_fast: true
# Skip generated/dependency directories
exclude: '^(vendor|node_modules|dist|build)/'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
# Fast, essential checks only
- id: trailing-whitespace
# Remove the --cached argument
- id: end-of-file-fixer
# Remove the --cached argument
- id: check-merge-conflict
- id: detect-private-key
- id: check-added-large-files
args: ["--maxkb=2500"]
- id: no-commit-to-branch
args: ["--branch", "develop", "--branch", "rel/.*"]
# Originally based on Rubocop's own pre-commit configuration
# https://github.com/rubocop/rubocop/blob/d5d8828/.pre-commit-hooks.yaml
# NOTE: Don't enable '--autocorrect' until codebase is clean
# Use Rubocop local hooks for better performance
# Fast local Rubocop checks (basic syntax)
- repo: local
hooks:
- id: local-rubocop-fast
name: Quick Rubocop
entry: bundle exec rubocop --force-exclusion --config .rubocop.yml --format json --fail-level error --only Syntax,Layout --no-server
language: system
types: [ruby]
files: \.(rb|rake)$
pass_filenames: true
- repo: https://github.com/avilaton/add-msg-issue-prefix-hook
rev: v0.0.11
hooks:
- id: add-msg-issue-prefix
stages: [prepare-commit-msg]
args:
- "--default=[UNTRACKED]"
- "--pattern=[a-zA-Z0-9]{0,10}-?[0-9]{1,5}"
- "--template=[#{}]"
# Quick local ESLint checks (syntax only)
- repo: local
hooks:
- id: local-eslint-fast
name: Quick ESLint
entry: node_modules/.bin/eslint --quiet
language: system
types: [file]
files: \.(mjs|ts|vue)$
- repo: local
hooks:
- id: register-build
stages: [post-commit, post-checkout, post-merge]
name: Record commit hash
entry: "sh -c 'git rev-parse --short HEAD > .commit_hash.txt; echo Commit hash recorded; head -4 .commit_hash.txt package.json'"
language: system
always_run: true
pass_filenames: false