From 67e1a9af7b4c2e044678d9c339131f816715dc55 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Thu, 28 Nov 2024 13:46:15 +0100 Subject: [PATCH] GH Actions: Enabled black formattef for subfolders inside cfbs Signed-off-by: Ole Herman Schumacher Elgesem --- .github/workflows/black-format.yml | 6 ++++-- .github/workflows/black.yml | 3 ++- cfbs/masterfiles/generate_release_information.py | 12 +++++++++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/black-format.yml b/.github/workflows/black-format.yml index f7bf72b2..d23d780b 100644 --- a/.github/workflows/black-format.yml +++ b/.github/workflows/black-format.yml @@ -23,7 +23,8 @@ jobs: python -m pip install black - name: Reformat with black run: | - black cfbs/*.py tests/*.py > black_output.txt 2>&1 + shopt -s globstar + black cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py > black_output.txt 2>&1 - name: Check if there are changes run: | git diff --exit-code || touch git_diff_exists @@ -43,7 +44,8 @@ jobs: run: | git config user.name 'GitHub' git config user.email '' - git add cfbs/*.py tests/*.py + shopt -s globstar + git add cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py git commit -F commit_message.txt - id: commit-message-from-file name: Parse commit message from file into variable diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml index 87143e9c..caaca50b 100644 --- a/.github/workflows/black.yml +++ b/.github/workflows/black.yml @@ -30,4 +30,5 @@ jobs: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Check formatting with black run: | - black --check cfbs/*.py tests/*.py + shopt -s globstar + black --check cfbs/*.py cfbs/**/*.py tests/*.py tests/**/*.py diff --git a/cfbs/masterfiles/generate_release_information.py b/cfbs/masterfiles/generate_release_information.py index aec568fc..ac99271f 100644 --- a/cfbs/masterfiles/generate_release_information.py +++ b/cfbs/masterfiles/generate_release_information.py @@ -17,11 +17,15 @@ def generate_release_information(omit_download=False, check=False): else: downloaded_versions = immediate_subdirectories(DOWNLOAD_PATH) - print("Downloading releases of masterfiles from cfengine.com and generating release information...") + print( + "Downloading releases of masterfiles from cfengine.com and generating release information..." + ) generate_vcf_download(DOWNLOAD_PATH, downloaded_versions) if check: - print("Downloading releases of masterfiles from git (github.com) and generating additional release information for comparison...") + print( + "Downloading releases of masterfiles from git (github.com) and generating additional release information for comparison..." + ) generate_vcf_git_checkout(downloaded_versions) print("Candidate release information generated.") print("Comparing files from cfengine.com and github.com...") @@ -32,4 +36,6 @@ def generate_release_information(omit_download=False, check=False): else: print("Release information successfully generated.") print("See the results in ./versions.json, ./checksums.json, and ./files.json") - print("(Run again with --check-against-git to download and compare with files from git, and generate -git.json files)") + print( + "(Run again with --check-against-git to download and compare with files from git, and generate -git.json files)" + )