From 7930aecfea797f1dd50a1583e44fe01fb93a42b8 Mon Sep 17 00:00:00 2001 From: zerolab Date: Thu, 22 Aug 2024 13:56:59 +0100 Subject: [PATCH] Lint --- .github/workflows/ruff.yml | 4 ++-- .pre-commit-config.yaml | 2 +- wagtail_localize/strings.py | 7 ++----- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml index 035e9933..2888cad8 100644 --- a/.github/workflows/ruff.yml +++ b/.github/workflows/ruff.yml @@ -16,8 +16,8 @@ jobs: - uses: actions/checkout@v4 # keep in sync with .pre-commit-config.yaml - - run: python -Im pip install --user ruff==0.4.8 + - run: python -Im pip install --user ruff==0.6.1 - name: Run ruff working-directory: . - run: ruff --output-format=github wagtail_localize + run: ruff check --output-format=github wagtail_localize diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1dff06a..26205be2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -14,7 +14,7 @@ repos: - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit # keep in sync with .github/workflows/ruff.yml - rev: 'v0.4.8' + rev: 'v0.6.1' hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] diff --git a/wagtail_localize/strings.py b/wagtail_localize/strings.py index 0d86f8ff..875502ed 100644 --- a/wagtail_localize/strings.py +++ b/wagtail_localize/strings.py @@ -335,12 +335,9 @@ def ignore_if_at_end(element): # Ignore if there are no text nodes # This will exclude both
tags and empty inline tags - if not any( + return not any( isinstance(desc, NavigableString) for desc in element.descendants - ): - return True - - return False + ) if ignore_if_at_end(elements[0]): wrap(elements[1:])