From 51cc447508dce0dabd180497c7e0d511474bc063 Mon Sep 17 00:00:00 2001 From: Carlos Camara Date: Fri, 12 Jan 2024 20:33:18 +0000 Subject: [PATCH 1/6] Pre-commit initial setup --- .pre-commit-config.yaml | 31 +++++++++++++++++++++++++++++++ requirements.txt | 1 + 2 files changed, 32 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..60ee12c97 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,31 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: trailing-whitespace + types: [file, text] + - id: end-of-file-fixer + types: [file, text] + - id: check-docstring-first + - id: check-case-conflict + - id: check-yaml + - repo: https://github.com/psf/black + rev: 22.12.0 + hooks: + - id: black + types: [python] + - repo: local + hooks: + - id: pylint + args: ["--rcfile=.pylintrc"] + name: Pylint + entry: python -m pylint + language: system + files: \.py$ + - repo: local + hooks: + - id: pytest + name: pytest + entry: ./bw-dev pytest + language: system + files: \.py$ diff --git a/requirements.txt b/requirements.txt index 6509effc7..4eee83b2c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -47,6 +47,7 @@ pylint==2.14.0 mypy==1.5.1 celery-types==0.18.0 django-stubs[compatible-mypy]==4.2.4 +pre-commit types-bleach==6.0.0.4 types-dataclasses==0.6.6 types-Markdown==3.4.2.10 From 8a0ea5af42bae180c6a70f657fe653bdb6355f45 Mon Sep 17 00:00:00 2001 From: Carlos Camara Date: Sat, 13 Jan 2024 16:20:38 +0000 Subject: [PATCH 2/6] Replace pylint with a hook and update hook versions --- .pre-commit-config.yaml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 60ee12c97..deb0d55c7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.5.0 hooks: - id: trailing-whitespace types: [file, text] @@ -10,18 +10,15 @@ repos: - id: check-case-conflict - id: check-yaml - repo: https://github.com/psf/black - rev: 22.12.0 + rev: 23.12.1 hooks: - id: black types: [python] - - repo: local + - repo: https://github.com/PyCQA/pylint + rev: v3.0.3 hooks: - id: pylint - args: ["--rcfile=.pylintrc"] - name: Pylint - entry: python -m pylint - language: system - files: \.py$ + types: [python] - repo: local hooks: - id: pytest From 66d4f20e7669cdace9414ec89456571b7ffb1d95 Mon Sep 17 00:00:00 2001 From: Carlos Camara Date: Sat, 13 Jan 2024 16:25:36 +0000 Subject: [PATCH 3/6] Add curlylint to precommit --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index deb0d55c7..7678528cc 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,11 @@ repos: hooks: - id: pylint types: [python] + - repo: https://github.com/thibaudcolas/curlylint + rev: v0.13.1 + hooks: + - id: curlylint + types: [html] - repo: local hooks: - id: pytest From be69065938f574c5af8ea3072f982cddaeb5cbff Mon Sep 17 00:00:00 2001 From: Carlos Camara Date: Sat, 13 Jan 2024 16:29:48 +0000 Subject: [PATCH 4/6] Add stylelint to precommit --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7678528cc..f20326135 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,6 +24,11 @@ repos: hooks: - id: curlylint types: [html] + - repo: https://github.com/awebdeveloper/pre-commit-stylelint + rev: 0.0.2 + hooks: + - id: stylelint + types: [css] - repo: local hooks: - id: pytest From ca1b0a90d3123af79f5a000d602f0da4d4b3b0b9 Mon Sep 17 00:00:00 2001 From: Carlos Camara Date: Sat, 13 Jan 2024 16:34:09 +0000 Subject: [PATCH 5/6] Add eslint to precommit --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f20326135..0817b6a14 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,6 +29,11 @@ repos: hooks: - id: stylelint types: [css] + - repo: https://github.com/pre-commit/mirrors-eslint + rev: v9.0.0-alpha.1 + hooks: + - id: eslint + types: [javascript] - repo: local hooks: - id: pytest From 68f0c81c7a783def0fad90ca8a2beb1ddfad2043 Mon Sep 17 00:00:00 2001 From: Carlos Camara Date: Sat, 13 Jan 2024 16:35:39 +0000 Subject: [PATCH 6/6] Comment pytest as it is not working I still do not know how to make this work --- .pre-commit-config.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0817b6a14..38c53b5ac 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,10 +34,10 @@ repos: hooks: - id: eslint types: [javascript] - - repo: local - hooks: - - id: pytest - name: pytest - entry: ./bw-dev pytest - language: system - files: \.py$ + # - repo: local + # hooks: + # - id: pytest + # name: pytest + # entry: ./bw-dev pytest + # language: system + # files: \.py$