mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-02 21:56:47 +00:00
Merge pull request #812 from zachborboa/master
Add flake8 and isort to lint check
This commit is contained in:
@@ -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 }}
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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"],
|
||||
|
||||
Reference in New Issue
Block a user