Skip to content

Commit

Permalink
Migrate to Black Python code formatter
Browse files Browse the repository at this point in the history
Change-Id: If9b79f4a3d4bd194291dd2293ba564a3aea65012
  • Loading branch information
winstonsung committed Aug 22, 2024
1 parent d2b97ed commit ee7e20f
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
33 changes: 33 additions & 0 deletions .github/workflows/black.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Black

on:
pull_request:
push:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.11" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Formatting the code with Black
run: |
black $(git ls-files '*.py')
- name: Add and commit
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add *
git commit -m "Format \"$(git log -1 --pretty=%s)\" using Black"
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements_dev.txt
- name: Analysing the code with pylint
- name: Analysing the code with Pylint
run: |
pylint $(git ls-files '*.py')
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ dependencies = [
]
# Lock file: requirements_dev.txt
optional-dependencies.dev = [
"black == 24.8.0",
"pylint == 3.2.6",
"pytest == 8.3.2",
]
4 changes: 4 additions & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
astroid == 3.2.4
black == 24.8.0
click == 8.1.7
colorama == 0.4.6
dill == 0.3.8
iniconfig == 2.0.0
isort == 5.13.2
mccabe == 0.7.0
mypy-extensions == 1.0.0
packaging == 24.1
pathspec == 0.12.1
platformdirs == 4.2.2
pluggy == 1.5.0
pylint == 3.2.6
Expand Down

0 comments on commit ee7e20f

Please sign in to comment.