Skip to content

Commit af377cd

Browse files
authored
style: update to ruff 0.9.0 formatting (canonical#2074)
This handles the cases where lint starts failing with ruff 0.9.0.
1 parent 3128c62 commit af377cd

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: fix-byte-order-marker
1414
- id: mixed-line-ending
1515
- repo: https://github.com/astral-sh/ruff-pre-commit
16-
rev: "v0.8.1"
16+
rev: "v0.9.0"
1717
hooks:
1818
# Run the linter
1919
- id: ruff

charmcraft/utils/platform.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# noqa: A005 (This module shadows the stdlib platform module.)
12
# Copyright 2023 Canonical Ltd.
23
#
34
# Licensed under the Apache License, Version 2.0 (the "License");

pyproject.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ lint.select = [ # Base linting rule selections.
258258
"RSE", # Errors on pytest raises.
259259
"RET", # Simpler logic after return, raise, continue or break
260260
"SIM", # Code simplification
261-
"TCH004", # Remove imports from type-checking guard blocks if used at runtime
262-
"TCH005", # Delete empty type-checking blocks
261+
"TC004", # Remove imports from type-checking guard blocks if used at runtime
262+
"TC005", # Delete empty type-checking blocks
263263
"ARG", # Unused arguments
264264
"PTH", # Migrate to pathlib
265265
"ERA", # Don't check in commented out code
@@ -293,7 +293,6 @@ lint.extend-select = [
293293
"RUF100", # #noqa directive that doesn't flag anything
294294
]
295295
lint.ignore = [
296-
"ANN10", # Type annotations for `self` and `cls`
297296
#"E203", # Whitespace before ":" -- Commented because ruff doesn't currently check E203
298297
"E501", # Line too long (reason: black will automatically fix this for us)
299298
"D105", # Missing docstring in magic method (reason: magic methods already have definitions)
@@ -351,7 +350,7 @@ ignore-decorators = [ # Functions with these decorators don't have to have docs
351350

352351
# Charmcraft-specific ignores, to be removed as we modernise the code.
353352
"A001", "A002",
354-
"PT004", "PT012",
353+
"PT012",
355354
"S105", "S106",
356355
]
357356
# isort leaves init files alone by default, this makes ruff ignore them too.

tests/test_jujuignore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,9 @@ def assert_matched_and_non_matched(globs, matched, unmatched, skip_git=False):
347347
text=True,
348348
)
349349
matched_out = p.stdout.splitlines()
350-
assert sorted(matched) == sorted(
351-
matched_out
352-
), f"expected exactly {matched} to match not {matched_out}"
350+
assert sorted(matched) == sorted(matched_out), (
351+
f"expected exactly {matched} to match not {matched_out}"
352+
)
353353

354354

355355
@pytest.mark.skipif(sys.platform == "win32", reason="Windows not [yet] supported")

0 commit comments

Comments
 (0)