Skip to content

Commit bce1f5d

Browse files
committed
feat: add pre-commit framework
1 parent e05aa44 commit bce1f5d

File tree

8 files changed

+140
-4
lines changed

8 files changed

+140
-4
lines changed

.markdownlint.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
MD001: false
2+
MD002: false
3+
MD003: false
4+
MD004: false
5+
MD005: false
6+
MD006: false
7+
MD007: false
8+
MD009: false
9+
MD010: false
10+
MD012: false
11+
MD013: false
12+
MD014: false
13+
MD019: false
14+
MD022: false
15+
MD023: false
16+
MD024: false
17+
MD026: false
18+
MD029: false
19+
MD030: false
20+
MD031: false
21+
MD032: false
22+
MD033: false
23+
MD034: false
24+
MD037: false
25+
MD040: false
26+
MD041: false
27+
MD042: false
28+
MD045: false
29+
MD046: false

.pre-commit-config.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
default_stages: [commit, push]
3+
default_language_version:
4+
# force all unspecified Python hooks to run python3
5+
python: python3
6+
minimum_pre_commit_version: "1.20.0"
7+
repos:
8+
- repo: meta
9+
hooks:
10+
- id: identity
11+
- id: check-hooks-apply
12+
- repo: https://github.com/pre-commit/pre-commit-hooks
13+
rev: v3.4.0
14+
hooks:
15+
- id: check-added-large-files
16+
# - id: check-ast
17+
# - id: check-builtin-literals
18+
- id: check-case-conflict
19+
- id: check-docstring-first
20+
- id: check-executables-have-shebangs
21+
# - id: check-json
22+
- id: check-merge-conflict
23+
- id: check-xml
24+
# - id: check-yaml
25+
# - id: debug-statements
26+
# - id: end-of-file-fixer
27+
- id: fix-byte-order-marker
28+
- id: mixed-line-ending
29+
# - id: pretty-format-json
30+
# - id: trailing-whitespace
31+
# - repo: https://github.com/psf/black
32+
# rev: 20.8b1
33+
# hooks:
34+
# - id: black
35+
# name: Run black on Python files
36+
# - repo: https://github.com/asottile/dead
37+
# rev: v1.4.0
38+
# hooks:
39+
# - id: dead
40+
# name: Dead simple python dead code detection
41+
# - repo: https://github.com/asottile/reorder_python_imports
42+
# rev: v2.4.0
43+
# hooks:
44+
# - id: reorder-python-imports
45+
# - repo: https://github.com/jumanjihouse/pre-commit-hooks
46+
# rev: 2.1.5
47+
# hooks:
48+
# - id: shellcheck
49+
# - repo: git://github.com/Lucas-C/pre-commit-hooks
50+
# rev: v1.1.9
51+
# hooks:
52+
# - id: forbid-tabs
53+
# - id: remove-tabs
54+
- repo: https://github.com/pre-commit/pygrep-hooks
55+
rev: v1.8.0
56+
hooks:
57+
- id: python-check-mock-methods
58+
- id: python-no-eval
59+
- id: python-no-log-warn
60+
- repo: https://github.com/igorshubovych/markdownlint-cli
61+
rev: v0.27.1
62+
hooks:
63+
- id: markdownlint
64+
name: Run markdownlint
65+
# - repo: https://github.com/adrienverge/yamllint
66+
# rev: v1.26.0
67+
# hooks:
68+
# - id: yamllint
69+
# name: Check YAML files with yamllint
70+
# entry: yamllint --strict .
71+
# types: [yaml]
72+
# - repo: https://github.com/PyCQA/bandit
73+
# rev: 1.7.0
74+
# hooks:
75+
# - id: bandit
76+
# - repo: https://gitlab.com/pycqa/flake8
77+
# rev: 3.8.4
78+
# hooks:
79+
# - id: flake8

.yamllint

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
3+
extends: default
4+
5+
rules:
6+
colons: disable
7+
comments: disable
8+
comments-indentation: disable
9+
document-start: disable
10+
indentation: disable
11+
line-length: disable
12+
truthy: disable

CONTRIBUTING.md

+19
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,22 @@ code base. Some basic rules include:
6969
- all files must have the Apache license in the header.
7070
- all PRs must have passing builds for all operating systems.
7171
- the code is correctly formatted as defined in the [Scalariform plugin properties](tools/eclipse/scala.properties). If you use IntelliJ for development this [page](https://plugins.jetbrains.com/plugin/7480-scalariform) describes the setup and configuration of the plugin.
72+
73+
#### Pre-commit
74+
75+
A framework for managing and maintaining multi-language pre-commit hooks.
76+
Pre-commit can be [installed](https://pre-commit.com/#installation) with `pip`, `curl`, `brew` or `conda`.
77+
78+
You need to first install pre-commit and then install the pre-commit hooks with `pre-commit install`.
79+
Now pre-commit will run automatically on git commit!
80+
81+
It's usually a good idea to run the hooks against all the files when adding new hooks (usually pre-commit will only run on the changed files during git hooks).
82+
Use `pre-commit run --all-files` to check all files.
83+
84+
You can update your hooks to the latest version automatically by running `pre-commit autoupdate`.
85+
86+
##### Hooks
87+
88+
The hooks run:
89+
90+
- [markdownlint-cli](https://github.com/igorshubovych/markdownlint-cli)

ansible/roles/controller/tasks/lean.yml

-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,3 @@
5151
userns_mode: "host"
5252
pid_mode: "host"
5353
privileged: "yes"
54-

ansible/roles/couchdb/tasks/deploy.yml

-1
Original file line numberDiff line numberDiff line change
@@ -183,4 +183,3 @@
183183
password: "{{ db.credentials.admin.pass }}"
184184
force_basic_auth: yes
185185
when: (inventory_hostname == coordinator) and (db.instances|int >= 2) and (cluster_state.json.state != "cluster_finished")
186-

core/monitoring/user-events/compose/prometheus/prometheus.yml

-1
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@ scrape_configs:
2727
- job_name: 'openwhisk-metrics'
2828
static_configs:
2929
- targets: ['user-events:9095']
30-

tests/dat/actions/unicode.tests/src/dotnet2.2/openwhisk-unicodetests-dotnet.sln

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
22

33
#
44
# Licensed to the Apache Software Foundation (ASF) under one or more

0 commit comments

Comments
 (0)