Skip to content

Commit cb98ed0

Browse files
dafyddjmyii
authored andcommitted
ci(pre-commit): add to formula [skip ci]
* Automated using myii/ssf-formula#259
1 parent 66f4ea7 commit cb98ed0

File tree

4 files changed

+80
-0
lines changed

4 files changed

+80
-0
lines changed

Diff for: .pre-commit-config.yaml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# -*- coding: utf-8 -*-
2+
# vim: ft=yaml
3+
---
4+
# See https://pre-commit.com for more information
5+
# See https://pre-commit.com/hooks.html for more hooks
6+
default_stages: [commit]
7+
repos:
8+
- repo: https://github.com/dafyddj/commitlint-pre-commit-hook
9+
rev: v2.3.0
10+
hooks:
11+
- id: commitlint
12+
name: Check commit message using commitlint
13+
description: Lint commit message against @commitlint/config-conventional rules
14+
stages: [commit-msg]
15+
additional_dependencies: ['@commitlint/[email protected]']
16+
- id: commitlint-travis
17+
stages: [manual]
18+
additional_dependencies: ['@commitlint/[email protected]']
19+
always_run: true
20+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
21+
rev: 2.1.3
22+
hooks:
23+
- id: shellcheck
24+
name: Check shell scripts with shellcheck
25+
files: ^.*\.(sh|bash|ksh)$
26+
types: []
27+
args: []
28+
- repo: https://github.com/adrienverge/yamllint.git
29+
rev: v1.23.0
30+
hooks:
31+
- id: yamllint
32+
name: Check YAML syntax with yamllint
33+
args: [--strict, '.']
34+
always_run: true
35+
pass_filenames: false
36+
- repo: https://github.com/warpnet/salt-lint
37+
rev: v0.3.0
38+
hooks:
39+
- id: salt-lint
40+
name: Check Salt files using salt-lint
41+
files: ^.*\.(sls|jinja|j2|tmpl|tst)$
42+
# - repo: https://github.com/myint/rstcheck
43+
# rev: 3f929574
44+
# hooks:
45+
# - id: rstcheck
46+
# name: Check reST files using rstcheck
47+
# args: [--report=warning]

Diff for: .rstcheck.cfg

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[rstcheck]
2+
report=error
3+
ignore_language=rst

Diff for: .travis.yml

+14
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ jobs:
6666
- gem install rubocop
6767
- rubocop -d
6868

69+
# Run `pre-commit` linters in a single job
70+
- language: 'python'
71+
env: 'Lint_pre-commit'
72+
name: 'Lint: pre-commit'
73+
before_install: 'skip'
74+
cache:
75+
directories:
76+
- $HOME/.cache/pre-commit
77+
script:
78+
# Install and run `pre-commit`
79+
- pip install pre-commit==2.7.1
80+
- pre-commit run --all-files --color always --verbose
81+
- pre-commit run --color always --hook-stage manual --verbose commitlint-travis
82+
6983
## Define the rest of the matrix based on Kitchen testing
7084
# Make sure the instances listed below match up with
7185
# the `platforms` defined in `kitchen.yml`

Diff for: bin/install-hooks

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env sh
2+
set -o nounset # Treat unset variables as an error and immediately exit
3+
set -o errexit # If a command fails exit the whole script
4+
5+
if [ "${DEBUG:-false}" = "true" ]; then
6+
set -x # Run the entire script in debug mode
7+
fi
8+
9+
if ! command -v pre-commit >/dev/null 2>&1; then
10+
echo "pre-commit not found: please install or check your PATH" >&2
11+
echo "See https://pre-commit.com/#installation" >&2
12+
exit 1
13+
fi
14+
15+
pre-commit install --install-hooks
16+
pre-commit install --hook-type commit-msg --install-hooks

0 commit comments

Comments
 (0)