From 17d7908450c600cd6bfc44f0564f055f1a51b9b1 Mon Sep 17 00:00:00 2001 From: Abe Coull Date: Fri, 18 Aug 2023 11:42:58 -0700 Subject: [PATCH 1/7] infra: update the pre-commit hook with linters and secrets check --- .pre-commit-config.yaml | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d03e4d3d2..ff4bc43ee 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,18 +1,8 @@ repos: -- repo: local - hooks: - - id: tox - name: tox - stages: [push] - language: system - entry: tox - types: [python] - pass_filenames: false - - - id: tox_integ_tests - name: tox integ tests - stages: [push] - language: system - entry: tox -e integ-tests - types: [python] - pass_filenames: false + - repo: local + hooks: + - id: tox_lintrs + name: linters + entry: tox -e linters + language: system + types: [python] From e95e93b8562932fc61f6612a446665d4bc152b6c Mon Sep 17 00:00:00 2001 From: Abe Coull Date: Fri, 18 Aug 2023 14:02:42 -0700 Subject: [PATCH 2/7] add a git commmit reminder --- .git-template/hooks/pre-commit | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .git-template/hooks/pre-commit diff --git a/.git-template/hooks/pre-commit b/.git-template/hooks/pre-commit new file mode 100644 index 000000000..004df88d2 --- /dev/null +++ b/.git-template/hooks/pre-commit @@ -0,0 +1,6 @@ +#!/usr/bin/env bash +if [ -f .pre-commit-config.yaml ]; then + echo 'pre-commit configuration detected, but `pre-commit install` was never run' 1>&2 + exit 1 +fi + From 79fdcbf277a17706f5c6ddcf40e662abb48e4227 Mon Sep 17 00:00:00 2001 From: Cody Wang Date: Thu, 31 Aug 2023 14:19:33 -0600 Subject: [PATCH 3/7] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff4bc43ee..8f1aa239f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: local hooks: - - id: tox_lintrs + - id: tox_linters name: linters entry: tox -e linters language: system From 2479899f071ba3b41c802cdd142535426cf542a6 Mon Sep 17 00:00:00 2001 From: Abe Coull Date: Wed, 6 Sep 2023 11:00:55 -0700 Subject: [PATCH 4/7] make linters run as read only --- .pre-commit-config.yaml | 4 ++-- tox.ini | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff4bc43ee..498c0a7b2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,6 @@ repos: hooks: - id: tox_lintrs name: linters - entry: tox -e linters + entry: tox -e linters_check language: system - types: [python] + types: [python] \ No newline at end of file diff --git a/tox.ini b/tox.ini index af1fd9097..e4ee4279a 100644 --- a/tox.ini +++ b/tox.ini @@ -41,6 +41,17 @@ commands = {[testenv:black]commands} {[testenv:flake8]commands} +# Read only linter env +[testenv:linters_check] +basepython = python3 +skip_install = true +deps = + {[testenv:black_check]deps} + {[testenv:flake8]deps} +commands = + {[testenv:black_check]commands} + {[testenv:flake8]commands} + [testenv:flake8] basepython = python3 skip_install = true @@ -68,6 +79,14 @@ deps = commands = black ./ {posargs} +[testenv:black_check] +basepython = python3 +skip_install = true +deps = + black +commands = + black --check . {posargs} + [testenv:docs] basepython = python3 deps = From 170fbba53d86acfd9f3cff0c79065c808e25fb4a Mon Sep 17 00:00:00 2001 From: Cody Wang Date: Wed, 6 Sep 2023 12:04:15 -0600 Subject: [PATCH 5/7] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index da29958b3..e9eea7581 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,4 +5,4 @@ repos: name: linters entry: tox -e linters_check language: system - types: [python] \ No newline at end of file + types: [python] From a06a217457b81bf56208c7f7ef3f08ea45c5baf8 Mon Sep 17 00:00:00 2001 From: Cody Wang Date: Wed, 6 Sep 2023 12:04:37 -0600 Subject: [PATCH 6/7] Update .git-template/hooks/pre-commit --- .git-template/hooks/pre-commit | 1 - 1 file changed, 1 deletion(-) diff --git a/.git-template/hooks/pre-commit b/.git-template/hooks/pre-commit index 004df88d2..6d8d24a1d 100644 --- a/.git-template/hooks/pre-commit +++ b/.git-template/hooks/pre-commit @@ -3,4 +3,3 @@ if [ -f .pre-commit-config.yaml ]; then echo 'pre-commit configuration detected, but `pre-commit install` was never run' 1>&2 exit 1 fi - From 6b7b045b11d96c9e36be81b4123eb570f855dbf0 Mon Sep 17 00:00:00 2001 From: Abe Coull Date: Wed, 13 Sep 2023 11:42:14 -0700 Subject: [PATCH 7/7] add isort check --- tox.ini | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tox.ini b/tox.ini index e4ee4279a..ba7cf8366 100644 --- a/tox.ini +++ b/tox.ini @@ -46,9 +46,11 @@ commands = basepython = python3 skip_install = true deps = + {[testenv:isort_check]deps} {[testenv:black_check]deps} {[testenv:flake8]deps} commands = + {[testenv:isort_check]commands} {[testenv:black_check]commands} {[testenv:flake8]commands} @@ -71,6 +73,14 @@ deps = commands = isort . {posargs} +[testenv:isort_check] +basepython = python3 +skip_install = true +deps = + isort +commands = + isort . -c {posargs} + [testenv:black] basepython = python3 skip_install = true