From 0c75171f88af8cd0768c1e251bc93ec4cf51c61b Mon Sep 17 00:00:00 2001 From: kluszcze Date: Thu, 12 Dec 2024 13:10:32 +0100 Subject: [PATCH 1/2] fix codespell errors in CODE_OF_CONDUCT and reusable_valgrind.yml Signed-off-by: kluszcze --- .github/workflows/reusable_valgrind.yml | 2 +- CODE_OF_CONDUCT.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable_valgrind.yml b/.github/workflows/reusable_valgrind.yml index 3e0af273a..aba0e3260 100644 --- a/.github/workflows/reusable_valgrind.yml +++ b/.github/workflows/reusable_valgrind.yml @@ -1,4 +1,4 @@ -# Run tests with valgrind intstrumentation tools: memcheck, drd, helgrind +# Run tests with valgrind instrumentation tools: memcheck, drd, helgrind name: Valgrind on: workflow_call diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 58dba18db..2e7fbf7d6 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -5,7 +5,7 @@ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, +identity and expression, level of experience, education, socioeconomic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation. From f70c7ca14a435b69de7582b2e9e5ea26d15dbdec Mon Sep 17 00:00:00 2001 From: kluszcze Date: Thu, 12 Dec 2024 13:08:51 +0100 Subject: [PATCH 2/2] add python script to run codespell scan Signed-off-by: Katarzyna Luszczewska --- .github/scripts/run-codespell.py | 40 +++++++++++++++++++++++++++ .github/workflows/reusable_checks.yml | 5 +++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 .github/scripts/run-codespell.py diff --git a/.github/scripts/run-codespell.py b/.github/scripts/run-codespell.py new file mode 100644 index 000000000..b87bf37bd --- /dev/null +++ b/.github/scripts/run-codespell.py @@ -0,0 +1,40 @@ +""" + Copyright (C) 2024 Intel Corporation + + Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT. + SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +""" + +import subprocess # nosec B404 +import logging +import sys + +logging.basicConfig( + level=logging.INFO, format="[%(levelname)s]: [%(asctime)s] %(message)s" +) + + +def codespell_scan(): + try: + codespell_result = subprocess.run( # nosec + [ + "codespell", + "-H", + "--quiet-level=3", + "--skip=./.git,./.venv,./.github/workflows/.spellcheck-conf.toml", + ], + text=True, + stdout=subprocess.PIPE, + ) + if codespell_result.returncode != 0: + for line in codespell_result.stdout.splitlines(): + logging.error(line.strip()) + sys.exit(1) + else: + logging.info("No spelling errors found") + except subprocess.CalledProcessError as ex: + logging.error(ex) + sys.exit(1) + + +codespell_scan() diff --git a/.github/workflows/reusable_checks.yml b/.github/workflows/reusable_checks.yml index e3e264b0d..6298b9883 100644 --- a/.github/workflows/reusable_checks.yml +++ b/.github/workflows/reusable_checks.yml @@ -29,7 +29,7 @@ jobs: python3 -m venv .venv . .venv/bin/activate echo "$PATH" >> $GITHUB_PATH - python3 -m pip install bandit + python3 -m pip install bandit codespell - name: Configure CMake run: > @@ -57,6 +57,9 @@ jobs: with: config: ./.github/workflows/.spellcheck-conf.toml + - name: Run codespell + run: python3 ./.github/scripts/run-codespell.py + # Run Bandit recursively, but omit _deps directory (with 3rd party code) and python's venv - name: Run Bandit run: python3 -m bandit -r . -x '/_deps/,/.venv/'