From 522455423d1a4319bdccfdaf71ce9dd63e4ab922 Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Wed, 1 Jul 2020 15:30:38 +0200 Subject: [PATCH] [pre-commit] Update configurations - Add isort - Update black repository reference - Add ast check and case conflict check Update flake8 configuration for line length to match the one from black. --- .flake8 | 4 ++-- .isort.cfg | 4 ++++ .pre-commit-config.yaml | 20 ++++++++++++++------ 3 files changed, 20 insertions(+), 8 deletions(-) create mode 100644 .isort.cfg diff --git a/.flake8 b/.flake8 index 5fabfee..994815d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,4 +1,4 @@ [flake8] -max-line-length = 80 +max-line-length = 88 select = B,C,E,F,W,T4,B9,B950 -ignore = E501, W503 +ignore = E501, W503, E203 diff --git a/.isort.cfg b/.isort.cfg new file mode 100644 index 0000000..8d7af1d --- /dev/null +++ b/.isort.cfg @@ -0,0 +1,4 @@ +[settings] +line_length=88 +order_by_type=true +lines_between_types=1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f4ee948..b8be7b7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,29 +1,37 @@ # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks repos: - - repo: https://github.com/ambv/black + - repo: https://github.com/timothycrosley/isort + rev: 4.3.21-2 + hooks: + - id: isort + args: [-sl] + - repo: https://github.com/psf/black rev: stable hooks: - - id: black - language_version: python3.6 - exclude: beat/core/test/prefix/algorithms/user/syntax_error/1.py|beat/core/test/prefix/databases/invalid/1.py + - id: black + exclude: beat/backend/python/test/prefix/.*/syntax_error - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.0.0 hooks: + - id: check-ast + exclude: beat/backend/python/test/prefix/.*/syntax_error + - id: check-case-conflict - id: trailing-whitespace - id: end-of-file-fixer - id: debug-statements - exclude: beat/core/test/prefix/algorithms/user/syntax_error/1.py|beat/core/test/prefix/databases/invalid/1.py + exclude: beat/backend/python/test/prefix/.*/syntax_error - id: check-added-large-files - id: check-docstring-first - id: flake8 + exclude: beat/backend/python/test/prefix/.*/(.*crash|syntax_error) - id: check-yaml exclude: conda/meta.yaml - repo: https://github.com/PyCQA/bandit rev: 'master' # Update me! hooks: - id: bandit - exclude: beat/editor/test|beat/core/test/prefix/algorithms/user/syntax_error/1.py|beat/core/test/prefix/databases/invalid/1.py + exclude: beat/backend/python/test/prefix/.*/syntax_error - repo: local hooks: - id: sphinx-build -- GitLab