|
| 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 | +default_stages: [commit, push] |
| 18 | +default_language_version: |
| 19 | + # force all unspecified Python hooks to run python3 |
| 20 | + python: python3 |
| 21 | +minimum_pre_commit_version: "1.20.0" |
| 22 | +repos: |
| 23 | + - repo: meta |
| 24 | + hooks: |
| 25 | + - id: identity |
| 26 | + - id: check-hooks-apply |
| 27 | + # - repo: https://github.com/thlorenz/doctoc.git |
| 28 | + # rev: v2.0.0 |
| 29 | + # hooks: |
| 30 | + # - id: doctoc |
| 31 | + # name: Add TOC for Markdown files |
| 32 | + # files: ^CONTRIBUTING\.md$ |
| 33 | + # args: |
| 34 | + # - "--maxlevel" |
| 35 | + # - "3" |
| 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 | + # exclude: ^tests/dat/actions/malformed\.py$ |
| 42 | + - repo: https://github.com/asottile/reorder_python_imports |
| 43 | + rev: v2.4.0 |
| 44 | + hooks: |
| 45 | + - id: reorder-python-imports |
| 46 | + exclude: ^tests/dat/actions/malformed\.py$ |
| 47 | + - repo: https://github.com/psf/black |
| 48 | + rev: 20.8b1 |
| 49 | + hooks: |
| 50 | + - id: black |
| 51 | + name: Run black on Python files |
| 52 | + exclude: ^tools/admin/wskadmin$|^tests/dat/actions/malformed\.py$ |
| 53 | + # - repo: https://github.com/jumanjihouse/pre-commit-hooks |
| 54 | + # rev: 2.1.5 |
| 55 | + # hooks: |
| 56 | + # - id: shellcheck |
| 57 | + - repo: git://github.com/Lucas-C/pre-commit-hooks |
| 58 | + rev: v1.1.9 |
| 59 | + hooks: |
| 60 | + # - id: insert-license |
| 61 | + # name: Add license for all other files |
| 62 | + # exclude: ^\.github/.*$ |
| 63 | + # args: |
| 64 | + # - --comment-style |
| 65 | + # - "|#|" |
| 66 | + # - --license-filepath |
| 67 | + # - license-templates/LICENSE.txt |
| 68 | + # - --fuzzy-match-generates-todo |
| 69 | + # files: > |
| 70 | + # \.cfg$|\.conf$|\.ini$|\.properties$|Dockerfile.*$ |
| 71 | + # - id: insert-license |
| 72 | + # name: Add license for all JS/CSS files |
| 73 | + # files: \.(js|css)$ |
| 74 | + # exclude: ^\.github/.*$ |
| 75 | + # args: |
| 76 | + # - --comment-style |
| 77 | + # - "/*!| *| */" |
| 78 | + # - --license-filepath |
| 79 | + # - license-templates/LICENSE.txt |
| 80 | + # - --fuzzy-match-generates-todo |
| 81 | + # - id: insert-license |
| 82 | + # name: Add license for all Markdown files |
| 83 | + # files: ^README\.md$ |
| 84 | + # exclude: ^\.github/.*$ |
| 85 | + # args: |
| 86 | + # - --comment-style |
| 87 | + # - "<!--|| -->" |
| 88 | + # - --license-filepath |
| 89 | + # - license-templates/LICENSE.txt |
| 90 | + # - --fuzzy-match-generates-todo |
| 91 | + # - id: insert-license |
| 92 | + # name: Add license for all Shell files |
| 93 | + # exclude: ^\.github/.*$ |
| 94 | + # files: \.(sh|bash)$ |
| 95 | + # args: |
| 96 | + # - --comment-style |
| 97 | + # - "|#|" |
| 98 | + # - --license-filepath |
| 99 | + # - license-templates/LICENSE.txt |
| 100 | + # - --fuzzy-match-generates-todo |
| 101 | + # - id: insert-license |
| 102 | + # name: Add license for all Python files |
| 103 | + # exclude: ^\.github/.*$ |
| 104 | + # types: [python] |
| 105 | + # args: |
| 106 | + # - --comment-style |
| 107 | + # - "|#|" |
| 108 | + # - --license-filepath |
| 109 | + # - license-templates/LICENSE.txt |
| 110 | + # - --fuzzy-match-generates-todo |
| 111 | + # - id: insert-license |
| 112 | + # name: Add license for all XML files |
| 113 | + # exclude: ^\.github/.*$ |
| 114 | + # files: \.xml$ |
| 115 | + # args: |
| 116 | + # - --comment-style |
| 117 | + # - "<!--||-->" |
| 118 | + # - --license-filepath |
| 119 | + # - license-templates/LICENSE.txt |
| 120 | + # - --fuzzy-match-generates-todo |
| 121 | + - id: insert-license |
| 122 | + name: Add license for all YAML files |
| 123 | + exclude: ^\.github/.*$ |
| 124 | + types: [yaml] |
| 125 | + files: \.(yml|yaml)$ |
| 126 | + args: |
| 127 | + - --comment-style |
| 128 | + - "|#|" |
| 129 | + - --license-filepath |
| 130 | + - license-templates/LICENSE.txt |
| 131 | + - --fuzzy-match-generates-todo |
| 132 | +# - id: forbid-tabs |
| 133 | +# - id: remove-tabs |
| 134 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 135 | + rev: v3.4.0 |
| 136 | + hooks: |
| 137 | + - id: check-added-large-files |
| 138 | + - id: check-ast |
| 139 | + exclude: ^tests/dat/actions/malformed\.py$ |
| 140 | + - id: check-builtin-literals |
| 141 | + exclude: ^tests/dat/actions/malformed\.py$ |
| 142 | + - id: check-case-conflict |
| 143 | + - id: check-docstring-first |
| 144 | + - id: check-executables-have-shebangs |
| 145 | + - id: check-json |
| 146 | + exclude: ^tests/dat/actions/invalid.*\.json$ |
| 147 | + - id: check-merge-conflict |
| 148 | + - id: check-vcs-permalinks |
| 149 | + - id: check-symlinks |
| 150 | + - id: check-xml |
| 151 | + - id: check-yaml |
| 152 | + exclude: ^tests/dat/apigw/local\.api\.bad\.yaml$ |
| 153 | + - id: debug-statements |
| 154 | + exclude: ^tests/dat/actions/malformed\.py$ |
| 155 | + - id: destroyed-symlinks |
| 156 | + # - id: detect-private-key |
| 157 | + - id: end-of-file-fixer |
| 158 | + files: \.(bal|bat|cfg|conf|cs|gradle|ini|java|md|properties|py|scala|sh|swift|txt|yml|yaml)$|^Dockerfile$ |
| 159 | + - id: fix-byte-order-marker |
| 160 | + exclude: ^tests/dat/actions/unicode\.tests/src/dotnet2\.2/openwhisk-unicodetests-dotnet\.sln$ |
| 161 | + - id: fix-encoding-pragma |
| 162 | + args: |
| 163 | + - --remove |
| 164 | + - id: mixed-line-ending |
| 165 | + # - id: name-tests-test |
| 166 | + # - id: pretty-format-json |
| 167 | + - id: trailing-whitespace |
| 168 | + exclude: ^\.github/ISSUE_TEMPLATE\.md$ |
| 169 | + - repo: https://github.com/pre-commit/pygrep-hooks |
| 170 | + rev: v1.8.0 |
| 171 | + hooks: |
| 172 | + - id: python-check-mock-methods |
| 173 | + - id: python-no-eval |
| 174 | + - id: python-no-log-warn |
| 175 | + - repo: https://github.com/igorshubovych/markdownlint-cli |
| 176 | + rev: v0.27.1 |
| 177 | + hooks: |
| 178 | + - id: markdownlint |
| 179 | + name: Run markdownlint |
| 180 | + entry: markdownlint |
| 181 | + files: \.(md|mdown|markdown)$ |
| 182 | + types: [markdown] |
| 183 | + - repo: https://github.com/adrienverge/yamllint |
| 184 | + rev: v1.26.0 |
| 185 | + hooks: |
| 186 | + - id: yamllint |
| 187 | + name: Check YAML files with yamllint |
| 188 | + entry: yamllint --strict . |
| 189 | + files: \.(yml|yaml)$ |
| 190 | + types: [yaml] |
| 191 | + # - repo: https://github.com/PyCQA/bandit |
| 192 | + # rev: 1.7.0 |
| 193 | + # hooks: |
| 194 | + # - id: bandit |
| 195 | + # - repo: https://gitlab.com/pycqa/flake8 |
| 196 | + # rev: 3.8.4 |
| 197 | + # hooks: |
| 198 | + # - id: flake8 |
0 commit comments