aboutsummaryrefslogtreecommitdiff
path: root/.pre-commit-config.yaml
diff options
context:
space:
mode:
authorRaul Farkas <raul.farkas@arm.com>2022-07-14 17:05:47 +0100
committerRaul Farkas <raul.farkas@arm.com>2022-07-20 14:44:08 +0100
commit7a09acbd1bccc9a7f81d79ed57259a0d32aa6873 (patch)
tree929695eb55a14a9fc9486d6d5917edbd9cce6cfc /.pre-commit-config.yaml
parentc9b4089b3037b5943565d76242d3016b8776f8d2 (diff)
downloadmlia-7a09acbd1bccc9a7f81d79ed57259a0d32aa6873.tar.gz
MLIA-529 Add pre-commit configuration
- Add pre-commit configuration file that is used to run a series of hooks on the codebase. - Update setup.cfg to include required pre-commit library when installing MLIA with the [dev] extra require. Change-Id: I8e88cd2bae98c03c20a70a320e82d2eb38ce127c
Diffstat (limited to '.pre-commit-config.yaml')
-rw-r--r--.pre-commit-config.yaml111
1 files changed, 111 insertions, 0 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 0000000..7033a29
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,111 @@
+# SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates.
+# SPDX-License-Identifier: Apache-2.0
+# Pre-commit checks
+#
+# General policy:
+
+# - tools that *fix* issues are preferred to tools that only *gripe*
+# about issues, both can coexist, but when the conflict we
+# selectivly reconfigure the griper not the fixer.
+#
+
+repos:
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.2.0
+ hooks:
+ - id: check-yaml
+
+ - id: end-of-file-fixer
+
+ - id: trailing-whitespace
+
+ - id: mixed-line-ending
+ args: ['--fix=lf']
+ description: Forces to replace line ending by the UNIX 'lf' character.
+
+ - id: detect-private-key
+
+ - id: check-executables-have-shebangs
+
+ - id: check-added-large-files
+ args: ['--maxkb=300', "--enforce-all"]
+ exclude: src/mlia/resources
+
+- repo: https://github.com/Lucas-C/pre-commit-hooks
+ rev: v1.1.13
+ hooks:
+ - id: remove-tabs
+ args: [--whitespaces-count, '8']
+
+- repo: https://github.com/asottile/reorder_python_imports
+ rev: v3.0.1
+ hooks:
+ - id: reorder-python-imports
+ args: ["--application-directories", ".:src"]
+
+- repo: https://github.com/psf/black
+ rev: 22.3.0
+ hooks:
+ - id: black
+
+- repo: https://github.com/PyCQA/flake8
+ rev: '4.0.1'
+ hooks:
+ - id: flake8
+
+- repo: https://github.com/PyCQA/pydocstyle
+ rev: 6.1.1
+ hooks:
+ - id: pydocstyle
+
+- repo: https://github.com/markdownlint/markdownlint
+ rev: v0.11.0
+ hooks:
+ - id: markdownlint
+ args: ["-r", "~MD024,~MD002"]
+
+- repo: https://github.com/ryanrhee/shellcheck-py
+ rev: v0.8.0.4
+ hooks:
+ - id: shellcheck
+ args: [-f, gcc, -x]
+
+- repo: https://github.com/fsfe/reuse-tool
+ rev: v1.0.0
+ hooks:
+ - id: reuse
+
+- repo: https://github.com/PrincetonUniversity/blocklint
+ rev: v0.2.3
+ hooks:
+ - id: blocklint
+ exclude: setup.cfg
+
+- repo: local
+ hooks:
+ - id: mypy
+ name: mypy
+ entry: mypy
+ language: python
+ types: [python]
+ require_serial: true
+ additional_dependencies: []
+
+- repo: local
+ hooks:
+ - id: pylint
+ name: pylint
+ entry: pylint
+ language: system
+ types: [python]
+
+- repo: local
+ hooks:
+ - id: pytest-cov
+ name: pytest coverage
+ stages: [push]
+ language: system
+ entry: pytest --cov=mlia --cov-report term-missing --cov-fail-under=95 tests
+ types: [python]
+ pass_filenames: false
+ verbose: true