Merge pull request #812 from zachborboa/master

Add flake8 and isort to lint check
This commit is contained in:
Zach Borboa
2023-09-09 09:46:40 -07:00
committed by GitHub
6 changed files with 56 additions and 29 deletions
-23
View File
@@ -1,23 +0,0 @@
name: Black code formatter
on:
pull_request:
jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install black
run: pip install black
- name: Get changed python files
id: changed-files
uses: tj-actions/changed-files@v39
with:
files: "**/*.py"
- name: Check changed files
if: steps.changed-files.outputs.any_changed == 'true'
run: black --check --color --diff --quiet ${{ steps.changed-files.outputs.all_changed_files }}
+43
View File
@@ -0,0 +1,43 @@
name: Lint
on:
pull_request:
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get changed python files
id: changed-files
uses: tj-actions/changed-files@v39
with:
files: "**/*.py"
- name: Install requirements
if: steps.changed-files.outputs.any_changed == 'true'
run: pip install black flake8 isort
- name: black changed files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
black --check --color --diff --quiet ${{ steps.changed-files.outputs.all_changed_files }}
- name: flake8 changed files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
flake8 ${{ steps.changed-files.outputs.all_changed_files }}
- name: isort changed files
if: steps.changed-files.outputs.any_changed == 'true'
run: |
set +e
isort --check-only --force-single-line-imports --profile black ${{ steps.changed-files.outputs.all_changed_files }}
exit_code="${?}"
if [[ "${exit_code}" -ne 0 ]]; then
isort --force-single-line-imports --profile black ${{ steps.changed-files.outputs.all_changed_files }}
git diff --color
exit "${exit_code}"
fi
+6 -2
View File
@@ -17,12 +17,16 @@ repos:
- id: black
name: black
entry: black
- repo: https://github.com/pycqa/flake8
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
name: isort
args: [--force-single-line-imports]
args: ["--force-single-line-imports", "--profile", "black"]
- repo: local
hooks:
- id: composer-validate
@@ -37,4 +41,4 @@ repos:
- id: pip-compile
name: pip-compile scripts/make_release_requirements.in
files: ^(.*/)?make_release_requirements\.(in|txt)$
args: [--output-file=scripts/make_release_requirements.txt, scripts/make_release_requirements.in]
args: ["--output-file=scripts/make_release_requirements.txt", "scripts/make_release_requirements.in"]
@@ -5,9 +5,9 @@
# See multi_curl_progress_advanced.php
#
# $ ipython multi_curl_progress_advanced_watch_tqdm.py
# php_manual_en.html.gz: 56%|████████████████████████ | 2.99M/5.34M [00:02<00:02, 1.14MB/s]
# php_manual_en.tar.gz: 23%|██████████▎ | 2.37M/10.4M [00:02<00:08, 901kB/s]
# php_manual_en.chm: 15%|███████▏ | 2.06M/13.7M [00:02<00:14, 783kB/s]
# php_manual_en.html.gz: 56%|████████████████████████ | 2.99M/5.34M [00:02<00:02, 1.14MB/s]
# php_manual_en.tar.gz: 23%|██████████▎ | 2.37M/10.4M [00:02<00:08, 901kB/s]
# php_manual_en.chm: 15%|███████▏ | 2.06M/13.7M [00:02<00:14, 783kB/s]
import json
import os
+2 -1
View File
@@ -222,7 +222,8 @@ def main():
tag_message = result["message"]
release_name = "Release {}".format(release_version)
release_message = (
"See [change log](https://github.com/php-curl-class/php-curl-class/blob/master/CHANGELOG.md) for changes.\n"
"See [change log]"
"(https://github.com/php-curl-class/php-curl-class/blob/master/CHANGELOG.md) for changes.\n"
"\n"
"https://github.com/php-curl-class/php-curl-class/compare/{}...{}".format(
result["old_version"],
+2
View File
@@ -0,0 +1,2 @@
[flake8]
max-line-length = 100