From 6c3c9dfe3b0e130fd36a851245ac061e3192789d Mon Sep 17 00:00:00 2001 From: ilan Date: Sun, 18 Jun 2023 12:30:20 +0300 Subject: [PATCH 1/6] template in CONTENT --- .pre-commit-config_template.yaml | 76 ++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .pre-commit-config_template.yaml diff --git a/.pre-commit-config_template.yaml b/.pre-commit-config_template.yaml new file mode 100644 index 000000000000..c109c5c1c0b1 --- /dev/null +++ b/.pre-commit-config_template.yaml @@ -0,0 +1,76 @@ +exclude: .devcontainer/|.vscode|Pipfile.lock|.gitlab/ci/|.circleci/|docs + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-json + - id: check-yaml + - id: check-ast + - id: check-merge-conflict + - id: debug-statements + language_version: python3 + - id: name-tests-test + files: .+_test.py$ + + - repo: https://github.com/hadialqattan/pycln + rev: v2.1.2 + hooks: + - id: pycln + + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: "v0.0.269" + hooks: + - id: ruff + + - repo: https://github.com/pre-commit/mirrors-autopep8 + rev: "v2.0.1" + hooks: + - id: autopep8 + - repo: local + hooks: + + - id: is-circle-changed + name: is-circle-changed + description: Checks if circle files are changed, and checkout to current if it is. + entry: ./Tests/scripts/is_file_up_to_date.sh .circleci/config.yml "" true + language: script + pass_filenames: false + + - id: is-gitlab-changed + name: is-gitlab-changed + description: Checks if gitlab files are changed, and checkout to current if it is. + entry: ./Tests/scripts/is_file_up_to_date.sh .gitlab "" true + language: script + pass_filenames: false + + - repo: https://github.com/demisto/demisto-sdk + rev: "" + hooks: + - id: mypy + args: + [ + --ignore-missing-imports, + --check-untyped-defs, + --show-error-codes, + --follow-imports=silent, + --allow-redefinition, + # `--python-version` argument is replaced in runtime + --python-version=3.10, + ] + exclude: "test_data|tests_data|.venv|.*_test.py$|infrastructure_tests" + + # enable with --test + - id: run-unit-tests + + - id: format + # update docker image to the latest version, assume no + args: ["-ud", "-n", "--no-validate", "-g"] + + - id: validate + args: ["-g"] + + - id: secrets + args: ["--ignore-entropy"] + + - id: no-implicit-optional From 129b056d6f947ff658dfc7409b66e2745a7e7a2e Mon Sep 17 00:00:00 2001 From: ilaner <88267954+ilaner@users.noreply.github.com> Date: Sun, 18 Jun 2023 14:31:21 +0300 Subject: [PATCH 2/6] Update .pre-commit-config_template.yaml Co-authored-by: dorschw <81086590+dorschw@users.noreply.github.com> --- .pre-commit-config_template.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config_template.yaml b/.pre-commit-config_template.yaml index c109c5c1c0b1..98afc66b40ac 100644 --- a/.pre-commit-config_template.yaml +++ b/.pre-commit-config_template.yaml @@ -19,7 +19,7 @@ repos: - id: pycln - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.0.269" + rev: "v0.0.272" hooks: - id: ruff From f8ce5dad8b19a320358932e317181060bd0f265c Mon Sep 17 00:00:00 2001 From: ilan Date: Sun, 18 Jun 2023 16:02:05 +0300 Subject: [PATCH 3/6] skip no implicit --- .pre-commit-config_template.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config_template.yaml b/.pre-commit-config_template.yaml index c109c5c1c0b1..28da80c899ea 100644 --- a/.pre-commit-config_template.yaml +++ b/.pre-commit-config_template.yaml @@ -74,3 +74,5 @@ repos: args: ["--ignore-entropy"] - id: no-implicit-optional + # remove this argument when this hook is ready to use + skip: true From fd15c5d88afb5902327abd54e0a4f3e62d8f01fc Mon Sep 17 00:00:00 2001 From: dorschw <81086590+dorschw@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:17:26 +0300 Subject: [PATCH 4/6] update codeowners --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index d87462f545ec..5de5758c0124 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -60,7 +60,6 @@ /Packs/CommonDashboards/ @michalgold @idovandijk /Packs/ContentManagement/ @mmhw - # Build related .circleci/config.yml @yucohen .gitlab/ci/* @yucohen @@ -82,6 +81,7 @@ Tests/scripts/lock_cloud_machines.py @daryakoval # SDK Related .gitlab/ci/sdk-nightly.yml @dorschw Utils/trigger_nightly_sdk_build.sh @dorschw +content/.pre-commit-config_template.yaml @dorschw @ilaner # XDR Related /Packs/CortexXDR/Integrations/ @dansterenson From 989490b947e621bd6c274c597eac86ebe0faa070 Mon Sep 17 00:00:00 2001 From: dorschw <81086590+dorschw@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:17:51 +0300 Subject: [PATCH 5/6] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 5de5758c0124..2e3b796db809 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -81,7 +81,7 @@ Tests/scripts/lock_cloud_machines.py @daryakoval # SDK Related .gitlab/ci/sdk-nightly.yml @dorschw Utils/trigger_nightly_sdk_build.sh @dorschw -content/.pre-commit-config_template.yaml @dorschw @ilaner +.pre-commit-config_template.yaml @dorschw @ilaner # XDR Related /Packs/CortexXDR/Integrations/ @dansterenson From 43173520dec315930e6c3de313500dc337c72cf2 Mon Sep 17 00:00:00 2001 From: ilaner <88267954+ilaner@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:47:55 +0300 Subject: [PATCH 6/6] Update .pre-commit-config_template.yaml Co-authored-by: dorschw <81086590+dorschw@users.noreply.github.com> --- .pre-commit-config_template.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.pre-commit-config_template.yaml b/.pre-commit-config_template.yaml index 46c3ef3138ce..9b6b65c461e8 100644 --- a/.pre-commit-config_template.yaml +++ b/.pre-commit-config_template.yaml @@ -1,3 +1,5 @@ +# This is a template, used and modified by the demisto-sdk pre-commit command. + exclude: .devcontainer/|.vscode|Pipfile.lock|.gitlab/ci/|.circleci/|docs repos: