Skip to content

Commit

Permalink
style: update to ruff 0.9.0 formatting (#2074)
Browse files Browse the repository at this point in the history
This handles the cases where lint starts failing with ruff 0.9.0.
  • Loading branch information
lengau authored Jan 13, 2025
1 parent 3128c62 commit af377cd
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: fix-byte-order-marker
- id: mixed-line-ending
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.1"
rev: "v0.9.0"
hooks:
# Run the linter
- id: ruff
Expand Down
1 change: 1 addition & 0 deletions charmcraft/utils/platform.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# noqa: A005 (This module shadows the stdlib platform module.)
# Copyright 2023 Canonical Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ lint.select = [ # Base linting rule selections.
"RSE", # Errors on pytest raises.
"RET", # Simpler logic after return, raise, continue or break
"SIM", # Code simplification
"TCH004", # Remove imports from type-checking guard blocks if used at runtime
"TCH005", # Delete empty type-checking blocks
"TC004", # Remove imports from type-checking guard blocks if used at runtime
"TC005", # Delete empty type-checking blocks
"ARG", # Unused arguments
"PTH", # Migrate to pathlib
"ERA", # Don't check in commented out code
Expand Down Expand Up @@ -293,7 +293,6 @@ lint.extend-select = [
"RUF100", # #noqa directive that doesn't flag anything
]
lint.ignore = [
"ANN10", # Type annotations for `self` and `cls`
#"E203", # Whitespace before ":" -- Commented because ruff doesn't currently check E203
"E501", # Line too long (reason: black will automatically fix this for us)
"D105", # Missing docstring in magic method (reason: magic methods already have definitions)
Expand Down Expand Up @@ -351,7 +350,7 @@ ignore-decorators = [ # Functions with these decorators don't have to have docs

# Charmcraft-specific ignores, to be removed as we modernise the code.
"A001", "A002",
"PT004", "PT012",
"PT012",
"S105", "S106",
]
# isort leaves init files alone by default, this makes ruff ignore them too.
Expand Down
6 changes: 3 additions & 3 deletions tests/test_jujuignore.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ def assert_matched_and_non_matched(globs, matched, unmatched, skip_git=False):
text=True,
)
matched_out = p.stdout.splitlines()
assert sorted(matched) == sorted(
matched_out
), f"expected exactly {matched} to match not {matched_out}"
assert sorted(matched) == sorted(matched_out), (
f"expected exactly {matched} to match not {matched_out}"
)


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

0 comments on commit af377cd

Please sign in to comment.