From bece89c481d44428cbee05774a710b804abed574 Mon Sep 17 00:00:00 2001 From: Antti Kaihola <13725+akaihola@users.noreply.github.com> Date: Sun, 20 Mar 2022 17:27:11 +0200 Subject: [PATCH] Use the Darker GitHub Action --- .github/workflows/python-package.yml | 25 +++++++++++++++---------- pgtricks/pg_dump_splitsort.py | 1 + 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 74a4de1..4ac18a9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -33,16 +33,21 @@ jobs: - name: Test with pytest run: > pytest - - name: Check formatting and linting with Darker - run: > - darker - --diff - --check - --revision=origin/master... - --isort - --lint=pylint - --lint=flake8 - . - name: Do static type checking with Mypy run: > mypy . + darker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Set up Python 3.10 + uses: actions/setup-python@v2 + with: + python-version: '3.10' + - uses: akaihola/darker@v2.1.1 + with: + options: --verbose --check --diff --isort --color + revision: origin/master... + lint: flake8 == 4.0.0 , pylint==2.13.2 diff --git a/pgtricks/pg_dump_splitsort.py b/pgtricks/pg_dump_splitsort.py index e962cb9..56908ea 100755 --- a/pgtricks/pg_dump_splitsort.py +++ b/pgtricks/pg_dump_splitsort.py @@ -24,6 +24,7 @@ def linecomp(l1: str, l2: str) -> int: p2 = l2.split('\t', 1) v1, v2 = cast(Tuple[float, float], try_float(p1[0], p2[0])) result = (v1 > v2) - (v1 < v2) + # modifying a line to see whether Darker works: if not result and len(p1) == len(p2) == 2: return linecomp(p1[1], p2[1]) return result