| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you under the Apache License, Version 2.0 (the | |
| # "License"); you may not use this file except in compliance | |
| # with the License. You may obtain a copy of the License at | |
| # | |
| # http://www.apache.org/licenses/LICENSE-2.0 | |
| # | |
| # Unless required by applicable law or agreed to in writing, | |
| # software distributed under the License is distributed on an | |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| # KIND, either express or implied. See the License for the | |
| # specific language governing permissions and limitations | |
| # under the License. | |
| --- | |
| default_stages: [pre-commit, pre-push] | |
| default_language_version: | |
| # force all unspecified Python hooks to run python3 | |
| python: python3 | |
| minimum_pre_commit_version: "3.2.0" | |
| repos: | |
| - repo: meta | |
| hooks: | |
| - id: identity | |
| - id: check-hooks-apply | |
| - repo: https://github.com/thlorenz/doctoc.git | |
| rev: 59dcae910a6ad4bbe8711275b854e3cd5c30f08b # frozen: v2.5.0 | |
| hooks: | |
| - id: doctoc | |
| name: Add TOC for Markdown files | |
| files: ^CONTRIBUTING\.md$|^INSTALL\.md$|^README\.md$ | |
| - repo: local | |
| hooks: | |
| - id: check-zip-file-is-not-committed | |
| name: check no zip files are committed | |
| description: Zip files are not allowed in the repository | |
| language: fail | |
| entry: | | |
| Zip files are not allowed in the repository as they are hard to | |
| track and have security implications. Please remove the zip file from the repository. | |
| files: (?i)\.zip$ | |
| exclude: ^core/src/test/resources/vhds/test\.vhd\.zip$ | |
| - repo: https://github.com/oxipng/oxipng | |
| rev: 340cd9878d8d8289f09fa101b48a8f5f0b7783f4 # frozen: v10.2.0 | |
| hooks: | |
| - id: oxipng | |
| name: run oxipng | |
| description: optimize PNG images with lossless compression | |
| args: ['-o', '4', '--strip', 'safe', '--alpha'] | |
| - repo: https://github.com/gitleaks/gitleaks | |
| rev: 83d9cd684c87d95d656c1458ef04895a7f1cbd8e # frozen: v8.30.1 | |
| hooks: | |
| - id: gitleaks | |
| name: run gitleaks | |
| description: detect hardcoded secrets | |
| - repo: https://github.com/Lucas-C/pre-commit-hooks | |
| rev: ad1b27d73581aa16cca06fc4a0761fc563ffe8e8 # frozen: v1.5.6 | |
| hooks: | |
| - id: chmod | |
| name: set file permissions | |
| args: ['644'] | |
| files: \.md$ | |
| stages: [manual] | |
| - id: insert-license | |
| name: add license for all cfg files | |
| description: automatically adds a licence header to all cfg files that don't have a license header | |
| files: \.cfg$ | |
| args: | |
| - --comment-style | |
| - '|#|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| - id: insert-license | |
| name: add license for all conf files | |
| description: automatically adds a license header to all conf files that don't have a license header | |
| files: \.conf$ | |
| args: | |
| - --comment-style | |
| - '|#|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| - id: insert-license | |
| name: add license for all Markdown files | |
| files: \.md$ | |
| args: | |
| - --comment-style | |
| - '<!--|| -->' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| exclude: ^(CHANGES|ISSUE_TEMPLATE|PULL_REQUEST_TEMPLATE)\.md$|^ui/docs/(full|smoke)-test-plan\.template\.md$|^\.github/workflows/.*\.md$|^\.github/aw/.*\.md$ | |
| - id: insert-license | |
| name: add license for all properties files | |
| description: automatically adds a licence header to all properties files that don't have a license header | |
| files: \.properties$ | |
| args: | |
| - --comment-style | |
| - '|#|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| - id: insert-license | |
| name: add license for all Shell files | |
| description: automatically adds a licence header to all Shell files that don't have a license header | |
| files: \.sh$ | |
| args: | |
| - --comment-style | |
| - '|#|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| - id: insert-license | |
| name: add license for all SQL files | |
| files: \.sql$ | |
| args: | |
| - --comment-style | |
| - '|--|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| - id: insert-license | |
| name: add license for all Vue files | |
| files: \.vue$ | |
| args: | |
| - --comment-style | |
| - '|//|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| - id: insert-license | |
| name: add license for all YAML files | |
| description: automatically adds a licence header to all YAML files that don't have a license header | |
| files: \.ya?ml$ | |
| args: | |
| - --comment-style | |
| - '|#|' | |
| - --license-filepath | |
| - .github/workflows/license-templates/LICENSE.txt | |
| - --fuzzy-match-generates-todo | |
| exclude: ^\.github/workflows/.*\.lock\.yml$ | |
| - repo: https://github.com/pre-commit/pre-commit-hooks | |
| rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0 | |
| hooks: | |
| #- id: check-added-large-files | |
| - id: check-case-conflict | |
| #- id: check-executables-have-shebangs | |
| - id: check-illegal-windows-names | |
| - id: check-merge-conflict | |
| - id: check-shebang-scripts-are-executable | |
| files: \.sh$ | |
| - id: check-symlinks | |
| - id: check-vcs-permalinks | |
| #- id: check-yaml | |
| - id: destroyed-symlinks | |
| - id: detect-aws-credentials | |
| args: [--allow-missing-credentials] | |
| - id: detect-private-key | |
| exclude: > | |
| (?x) | |
| ^scripts/vm/systemvm/id_rsa\.cloud$| | |
| ^server/src/test/java/org/apache/cloudstack/network/ssl/CertServiceTest\.java$| | |
| ^server/src/test/java/com/cloud/keystore/KeystoreTest\.java$| | |
| ^server/src/test/resources/certs/dsa_self_signed\.key$| | |
| ^server/src/test/resources/certs/non_root\.key$| | |
| ^server/src/test/resources/certs/root_chain\.key$| | |
| ^server/src/test/resources/certs/rsa_ca_signed\.key$| | |
| ^server/src/test/resources/certs/rsa_self_signed_with_pwd\.key$| | |
| ^server/src/test/resources/certs/rsa_self_signed\.key$| | |
| ^services/console-proxy/rdpconsole/src/test/doc/rdp-key\.pem$| | |
| ^systemvm/agent/certs/localhost\.key$| | |
| ^systemvm/agent/certs/systemvm\.key$| | |
| ^test/integration/smoke/test_ssl_offloading\.py$ | |
| - id: end-of-file-fixer | |
| exclude: \.vhd$|\.svg$ | |
| - id: file-contents-sorter | |
| args: [--unique] | |
| files: ^\.github/linters/codespell\.txt$ | |
| - id: fix-byte-order-marker | |
| - id: forbid-submodules | |
| - id: mixed-line-ending | |
| - id: trailing-whitespace | |
| files: ^(LICENSE|NOTICE)$|README$|\.(bat|cfg|config|cs|css|erb|gitignore|header|in|install|java|md|properties|py|rb|rc|sh|sql|svg|te|template|txt|ucls|vue|xml|xsl|yaml|yml)$|^cloud-cli/bindir/cloud-tool$|^debian/changelog$ | |
| args: [--markdown-linebreak-ext=md] | |
| exclude: ^services/console-proxy/rdpconsole/src/test/doc/freerdp-debug-log\.txt$ | |
| - repo: https://github.com/codespell-project/codespell | |
| rev: 57b21406f092110c18776e39b0bda50d37c945c8 # frozen: v2.4.3 | |
| hooks: | |
| - id: codespell | |
| name: run codespell | |
| description: Check spelling with codespell | |
| - repo: https://github.com/pycqa/flake8 | |
| rev: c48217e1fc006c2dddd14df54e83b67da15de5cd # frozen: 7.3.0 | |
| hooks: | |
| - id: flake8 | |
| args: [--config, .github/linters/.flake8] | |
| - repo: https://github.com/igorshubovych/markdownlint-cli | |
| rev: 5b5dddc4fb0f83c3ea1fc5616fa63e115dce83e0 # frozen: v0.49.1 | |
| hooks: | |
| - id: markdownlint | |
| name: run markdownlint | |
| description: check Markdown files with markdownlint | |
| args: [--config=.github/linters/.markdown-lint.yml] | |
| types: [markdown] | |
| files: \.md$ | |
| - repo: https://github.com/adrienverge/yamllint | |
| rev: cba56bcde1fdd01c1deb3f945e69764c291a6530 # frozen: v1.38.0 | |
| hooks: | |
| - id: yamllint | |
| name: run yamllint | |
| description: check YAML files with yamllint | |
| args: [--config-file=.github/linters/.yamllint.yml] | |
| types: [yaml] | |
| files: \.ya?ml$ | |
| exclude: ^.*k8s-.*\.ya?ml$|^.github/workflows/.*\.lock\.ya?ml$ | |
| - repo: https://github.com/python-jsonschema/check-jsonschema | |
| rev: 12e63946db2c5cfcc9030fac21c3883ba88c6ed8 # frozen: 0.38.0 | |
| hooks: | |
| - id: check-dependabot | |
| name: validate dependabot config | |
| description: ensures the dependabot config file is valid | |
| files: ^\.github/dependabot\.ya?ml$ |