From a9e141de0560e2ed7ecdb2154c851108d98f54b2 Mon Sep 17 00:00:00 2001 From: edbjunwang Date: Mon, 13 Jan 2025 17:47:09 +0800 Subject: [PATCH 1/4] test: code style checking --- .github/workflows/python-codestyle.yml | 2 +- pycode/another.py | 16 ++++++++++++++++ pycode/main.py | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 pycode/another.py diff --git a/.github/workflows/python-codestyle.yml b/.github/workflows/python-codestyle.yml index e900e8f..cf57508 100644 --- a/.github/workflows/python-codestyle.yml +++ b/.github/workflows/python-codestyle.yml @@ -7,7 +7,7 @@ on: branches: [ master ] jobs: - verify-commits: + check-python-code-style: runs-on: ubuntu-22.04 steps: - name: Checkout code diff --git a/pycode/another.py b/pycode/another.py new file mode 100644 index 0000000..57f6b87 --- /dev/null +++ b/pycode/another.py @@ -0,0 +1,16 @@ +# This program adds two numbers + +num1 = 1.5 +num2 = 6.3 + +# make a very long line to check if pycodestype can detect that... blah blaaaahhh blaahhhh blaaaaaaaaaaaaahhhhhhh blaaaaaaaaaaaahhhh blahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh + +# Add two numbers +sum = num1 + num2 + +# Display the sum +print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) + +if sum: + print('The sum is not zeor\n') + diff --git a/pycode/main.py b/pycode/main.py index 57f6b87..d007636 100644 --- a/pycode/main.py +++ b/pycode/main.py @@ -13,4 +13,7 @@ if sum: print('The sum is not zeor\n') +else: + print('The sum is zeor\n') + From ecc92dad86b4d58b3d0a33f02cfda8450ca3eed5 Mon Sep 17 00:00:00 2001 From: edbjunwang Date: Tue, 14 Jan 2025 11:07:07 +0800 Subject: [PATCH 2/4] test: code style checking --- pycode/main.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pycode/main.py b/pycode/main.py index d007636..e61b5fb 100644 --- a/pycode/main.py +++ b/pycode/main.py @@ -3,7 +3,9 @@ num1 = 1.5 num2 = 6.3 -# make a very long line to check if pycodestype can detect that... blah blaaaahhh blaahhhh blaaaaaaaaaaaaahhhhhhh blaaaaaaaaaaaahhhh blahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh +# make a very long line to check if pycodestype can detect that... +# blah blaaaahhh blaahhhh blaaaaaaaaaaaaahhhhhhh +# blaaaaaaaaaaaahhhh blahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh # Add two numbers sum = num1 + num2 From 8b343be6cc1d7e1350ba6cf67726195dd87e729f Mon Sep 17 00:00:00 2001 From: edbjunwang Date: Mon, 20 Jan 2025 13:51:45 +0800 Subject: [PATCH 3/4] chore: run pycodestyle on the whole of changed files --- .github/workflows/python-codestyle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-codestyle.yml b/.github/workflows/python-codestyle.yml index cf57508..8d31018 100644 --- a/.github/workflows/python-codestyle.yml +++ b/.github/workflows/python-codestyle.yml @@ -32,5 +32,5 @@ jobs: git checkout $GITHUB_BASE_REF echo "head ref: $GITHUB_HEAD_REF" git checkout $GITHUB_HEAD_REF - git --no-pager diff $GITHUB_BASE_REF $GITHUB_HEAD_REF --name-only |grep ".py$" |xargs git --no-pager diff $GITHUB_BASE_REF $GITHUB_HEAD_REF | pycodestyle --show-source --diff + git --no-pager diff $GITHUB_BASE_REF $GITHUB_HEAD_REF --name-only |grep ".py$" |xargs pycodestyle --show-source From 762119790c15d06ac10858dcc95e830c8cfaf1b5 Mon Sep 17 00:00:00 2001 From: edbjunwang Date: Mon, 20 Jan 2025 13:56:12 +0800 Subject: [PATCH 4/4] chore: using python 3.11 --- .github/workflows/python-codestyle.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/python-codestyle.yml b/.github/workflows/python-codestyle.yml index 8d31018..96d6280 100644 --- a/.github/workflows/python-codestyle.yml +++ b/.github/workflows/python-codestyle.yml @@ -15,10 +15,10 @@ jobs: with: fetch-depth: '0' - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install pycodestype run: |