Skip to content

Commit 643a13e

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

File tree

7 files changed

+191
-3
lines changed

7 files changed

+191
-3
lines changed

.markdownlint.yml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
MD001: false
19+
MD002: false
20+
MD003: false
21+
MD004: false
22+
MD005: false
23+
MD006: false
24+
MD007: false
25+
MD009: false
26+
MD010: false
27+
MD012: false
28+
MD013: false
29+
MD014: false
30+
MD019: false
31+
MD022: false
32+
MD023: false
33+
MD024: false
34+
MD026: false
35+
MD029: false
36+
MD030: false
37+
MD031: false
38+
MD032: false
39+
MD033: false
40+
MD034: false
41+
MD037: false
42+
MD040: false
43+
MD041: false
44+
MD042: false
45+
MD045: false
46+
MD046: false

.pre-commit-config.yaml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
---
18+
default_stages: [commit, push]
19+
default_language_version:
20+
# force all unspecified Python hooks to run python3
21+
python: python3
22+
minimum_pre_commit_version: "1.20.0"
23+
repos:
24+
- repo: meta
25+
hooks:
26+
- id: identity
27+
- id: check-hooks-apply
28+
- repo: https://github.com/pre-commit/pre-commit-hooks
29+
rev: v3.4.0
30+
hooks:
31+
- id: check-added-large-files
32+
# - id: check-ast
33+
# - id: check-builtin-literals
34+
- id: check-case-conflict
35+
- id: check-docstring-first
36+
- id: check-executables-have-shebangs
37+
# - id: check-json
38+
- id: check-merge-conflict
39+
- id: check-xml
40+
# - id: check-yaml
41+
# - id: debug-statements
42+
# - id: end-of-file-fixer
43+
# - id: fix-byte-order-marker
44+
- id: mixed-line-ending
45+
# - id: pretty-format-json
46+
# - id: trailing-whitespace
47+
# - repo: https://github.com/psf/black
48+
# rev: 20.8b1
49+
# hooks:
50+
# - id: black
51+
# name: Run black on Python files
52+
# - repo: https://github.com/asottile/dead
53+
# rev: v1.4.0
54+
# hooks:
55+
# - id: dead
56+
# name: Dead simple python dead code detection
57+
# - repo: https://github.com/asottile/reorder_python_imports
58+
# rev: v2.4.0
59+
# hooks:
60+
# - id: reorder-python-imports
61+
# - repo: https://github.com/jumanjihouse/pre-commit-hooks
62+
# rev: 2.1.5
63+
# hooks:
64+
# - id: shellcheck
65+
# - repo: git://github.com/Lucas-C/pre-commit-hooks
66+
# rev: v1.1.9
67+
# hooks:
68+
# - id: forbid-tabs
69+
# - id: remove-tabs
70+
- repo: https://github.com/pre-commit/pygrep-hooks
71+
rev: v1.8.0
72+
hooks:
73+
- id: python-check-mock-methods
74+
- id: python-no-eval
75+
- id: python-no-log-warn
76+
- repo: https://github.com/igorshubovych/markdownlint-cli
77+
rev: v0.27.1
78+
hooks:
79+
- id: markdownlint
80+
name: Run markdownlint
81+
- repo: https://github.com/adrienverge/yamllint
82+
rev: v1.26.0
83+
hooks:
84+
- id: yamllint
85+
name: Check YAML files with yamllint
86+
entry: yamllint --strict .
87+
# - repo: https://github.com/PyCQA/bandit
88+
# rev: 1.7.0
89+
# hooks:
90+
# - id: bandit
91+
# - repo: https://gitlab.com/pycqa/flake8
92+
# rev: 3.8.4
93+
# hooks:
94+
# - id: flake8

.yamllint

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Licensed to the Apache Software Foundation (ASF) under one or more
3+
# contributor license agreements. See the NOTICE file distributed with
4+
# this work for additional information regarding copyright ownership.
5+
# The ASF licenses this file to You under the Apache License, Version 2.0
6+
# (the "License"); you may not use this file except in compliance with
7+
# the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
---
18+
19+
extends: default
20+
21+
ignore: |
22+
/tests/dat/apigw/local.api.bad.yaml
23+
24+
rules:
25+
colons: disable
26+
comments: disable
27+
comments-indentation: disable
28+
document-start: disable
29+
indentation: disable
30+
line-length: disable
31+
truthy: disable

CONTRIBUTING.md

+20
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,23 @@ 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)
91+
- [yamllint](https://github.com/adrienverge/yamllint)

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-

0 commit comments

Comments
 (0)