Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code formatting/linting workflow #2186

Merged
merged 1 commit into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions .github/workflows/format_check.yml

This file was deleted.

69 changes: 69 additions & 0 deletions .github/workflows/formatting_linting.yml
Original file line number Diff line number Diff line change
@@ -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/checkout@v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Run Black
uses: psf/black@24.4.2
with:
options: "--version --check --diff --color" # default: "--check --diff"

flake8:
name: Flake8 linter
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment – ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5.1.0
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/checkout@v4.1.6
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Set up Python environment – ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5.1.0
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
7 changes: 2 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Loading