Skip to content

Video editing with Python

refactor(workflows): code formatting and linting

K Kollmanne4c1a097bf4a
diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml
deleted file mode 100644
index cb6273c6..00000000
--- a/.github/workflows/format_check.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-name: Code Format Check
-
-on:
- push:
- branches:
- - master
- pull_request:
-
-
-jobs:
- black:
- runs-on: ubuntu-latest
- name: Black
- steps:
- - uses: actions/[email protected]
- - name: Set up Python
- uses: actions/[email protected]
- - name: Black
- uses: psf/[email protected] # already includes args "--check --diff"
- flake8:
- runs-on: ubuntu-latest
- name: Flake8
- steps:
- - uses: actions/[email protected]
- - name: Set up Python
- uses: actions/[email protected]
- with:
- python-version: '3.9'
- - name: Install dependencies
- run: |
- python -m pip install --upgrade wheel pip
- pip install .[lint]
- - name: Lint examples
- run: flake8 examples --show-source
- - name: Lint scripts
- run: flake8 setup.py docs/conf.py scripts --show-source
- - name: Lint tests
- run: flake8 tests --show-source
- - name: Lint moviepy
- run: flake8 moviepy --show-source
- isort:
- runs-on: ubuntu-latest
- name: isort
- steps:
- - uses: actions/[email protected]
- - name: Set up Python
- uses: actions/[email protected]
- with:
- python-version: '3.9'
- - name: Install dependencies
- run: |
- python -m pip install --upgrade pip
- pip install isort
- - name: Check imports
- run: isort --check-only moviepy tests examples docs/conf.py scripts
diff --git a/.github/workflows/formatting_linting.yml b/.github/workflows/formatting_linting.yml
new file mode 100644
index 00000000..e3d75242
--- /dev/null
+++ b/.github/workflows/formatting_linting.yml
@@ -0,0 +1,69 @@
+# SPDX-FileCopyrightText: 2024 K Kollmann
+# SPDX-License-Identifier: MIT
+
+name: Code formatting and linting
+
+on:
+ pull_request:
+ push:
+ branches:
+ - master
+ - main
+ workflow_dispatch:
+
+env:
+ PYTHON_VERSION: "3.9"
+
+jobs:
+ black:
+ name: Black code formatter
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/[email protected]
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ - name: Run Black
+ uses: psf/[email protected]
+ with:
+ options: "--version --check --diff --color" # default: "--check --diff"
+
+ flake8:
+ name: Flake8 linter
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/[email protected]
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ - name: Set up Python environment – ${{ env.PYTHON_VERSION }}
+ uses: actions/[email protected]
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade wheel pip
+ pip install .[lint]
+ - name: Show Flake8 version
+ run: flake8 --version
+ - name: Run Flake8
+ run: flake8 -v --show-source moviepy setup.py scripts docs/conf.py examples tests
+
+ isort:
+ name: isort import sorter
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout repo
+ uses: actions/[email protected]
+ with:
+ ref: ${{ github.event.pull_request.head.sha }}
+ - name: Set up Python environment – ${{ env.PYTHON_VERSION }}
+ uses: actions/[email protected]
+ with:
+ python-version: ${{ env.PYTHON_VERSION }}
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade wheel pip
+ pip install .[lint]
+ - name: Run isort
+ run: isort --check-only --diff moviepy setup.py scripts docs/conf.py examples tests
diff --git a/setup.cfg b/setup.cfg
index 9abc1632..f524d3f2 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -40,13 +40,10 @@ docstring-convention = numpy
#max-complexity = 10
[isort]
+profile = black
lines_after_imports = 2
-multi_line_output = 3
-line_length = 88
-use_parentheses = True
combine_as_imports = True
-include_trailing_comma = True
-py_version = 36
+py_version = 39
known_tests_third_party = pytest
sections = STDLIB,THIRDPARTY,TESTS_THIRD_PARTY,FIRSTPARTY,LOCALFOLDER