Skip to content

Commit

Permalink
CI(deps): Update ruff to v0.6.5 (#4315)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
renovate[bot] and echoix committed Sep 16, 2024
1 parent 3dbe2d7 commit 560340a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-code-quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions man/parser_standard_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
6 changes: 2 additions & 4 deletions python/grass/gunittest/reporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions utils/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 560340a

Please sign in to comment.