From ea6111a36e55501bbfb9ea022aaf8305b4d80183 Mon Sep 17 00:00:00 2001 From: Diego Russo Date: Tue, 14 Apr 2020 18:41:58 +0100 Subject: Add pre-commit support for sanity checks Use pre-commit framework [1] to run black and flake8 before the commit. black and flake8 are managed by the pre-commit framework and they can be run manually by the user using `pre-commit run` command. Fix the code base with the help of black and flake8. Fix import statements according to PEP8 guidelines [1] Both tools have the following settings (specified in the pre-commit configuration file): * line length: 120 characters * directory to exclude: ethosu/vela/tflite/ and ethosu/vela/ethos_u55_regs Updated README.md on how to install pre-commit and how to run sanity checks. Pipenv files have been updated including new dependencies for pre-commit. [1]: https://www.python.org/dev/peps/pep-0008/#imports [2]: https://github.com/pre-commit/pre-commit Change-Id: I304d9fffdf019d390ffa396a529c8a7c2437f63d Signed-off-by: Diego Russo --- .pre-commit-config.yaml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .pre-commit-config.yaml (limited to '.pre-commit-config.yaml') diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..0695effb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +exclude: '^ethosu/vela/(tflite|ethos_u55_regs)/' +repos: +- repo: https://github.com/ambv/black + rev: stable + hooks: + - id: black + language_version: python3.6 + args: [--line-length=120] + +- repo: https://gitlab.com/pycqa/flake8 + rev: 3.7.9 + hooks: + - id: flake8 + args: [--max-line-length=120, --extend-ignore=E203] -- cgit v1.2.1