From 560340a9c01414469996b3f94d60406d1297e2c5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 09:33:53 -0400 Subject: [PATCH] CI(deps): Update ruff to v0.6.5 (#4315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * CI(deps): Update ruff to v0.6.5 * style: Fix FURB188: Prefer `removeprefix` over conditionally replacing with slice. Ruff rule: https://docs.astral.sh/ruff/rules/slice-to-remove-prefix-or-suffix/ This is a new rule introduced in ruff 0.6.5 --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Edouard Choinière <27212526+echoix@users.noreply.github.com> --- .github/workflows/python-code-quality.yml | 2 +- .pre-commit-config.yaml | 2 +- man/parser_standard_options.py | 3 +-- python/grass/gunittest/reporters.py | 6 ++---- utils/generate_release_notes.py | 4 +--- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/python-code-quality.yml b/.github/workflows/python-code-quality.yml index f5810fbe7c2..cd2624051a5 100644 --- a/.github/workflows/python-code-quality.yml +++ b/.github/workflows/python-code-quality.yml @@ -36,7 +36,7 @@ jobs: # renovate: datasource=pypi depName=bandit BANDIT_VERSION: "1.7.9" # renovate: datasource=pypi depName=ruff - RUFF_VERSION: "0.6.4" + RUFF_VERSION: "0.6.5" runs-on: ${{ matrix.os }} permissions: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a5221f29efe..3fdb0741681 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,7 +37,7 @@ repos: ) - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.6.4 + rev: v0.6.5 hooks: # Run the linter. - id: ruff diff --git a/man/parser_standard_options.py b/man/parser_standard_options.py index 15d1e0fc9ae..ad027a1b6b4 100644 --- a/man/parser_standard_options.py +++ b/man/parser_standard_options.py @@ -47,8 +47,7 @@ def split_opt_line(line): index = line.index("=") key = line[:index].strip() default = line[index + 1 :].strip() - if default.startswith("_("): - default = default[2:] + default = default.removeprefix("_(") return key, default def parse_glines(glines): diff --git a/python/grass/gunittest/reporters.py b/python/grass/gunittest/reporters.py index 0911ca0fdd7..ec175613bc3 100644 --- a/python/grass/gunittest/reporters.py +++ b/python/grass/gunittest/reporters.py @@ -172,8 +172,7 @@ def get_svn_revision(): rc = p.poll() if not rc: stdout = stdout.strip() - if stdout.endswith("M"): - stdout = stdout[:-1] + stdout = stdout.removesuffix("M") if ":" in stdout: # the first one is the one of source code stdout = stdout.split(":")[0] @@ -211,8 +210,7 @@ def get_svn_info(): if relurl is not None: relurl = relurl.text # relative path has ^ at the beginning in SVN version 1.8.8 - if relurl.startswith("^"): - relurl = relurl[1:] + relurl = relurl.removeprefix("^") else: # SVN version 1.8.8 supports relative-url but older do not # so, get relative part from absolute URL diff --git a/utils/generate_release_notes.py b/utils/generate_release_notes.py index 3cfffe77bd2..66aa4ced08c 100755 --- a/utils/generate_release_notes.py +++ b/utils/generate_release_notes.py @@ -97,9 +97,7 @@ def print_category(category, changes, file=None): # Relies on author being specified as username. if " " in author: author = author.split(" ", maxsplit=1)[0] - if author.startswith("@"): - # We expect that to be always the case, but we test anyway. - author = author[1:] + author = author.removeprefix("@") if author in known_bot_names or author.endswith("[bot]"): hidden.append(item) elif len(visible) > max_section_length: