Skip to content

Commit

Permalink
Bump Ruff to 0.8.0 (#949)
Browse files Browse the repository at this point in the history
Hi! I just released Ruff 0.8.0. This release removes a few rules that
had been deprecated for a few releases, so Ruff 0.8.0 would have started
emitting warnings when linting `scikit-build-core` due to the fact that
you have some of these now-removed rules explicitly ignored in your Ruff
config.

This PR gets rid of the removed rules from your Ruff config. There's
also some additional changes made here due to some rule stabilisations
in this release -- let me know if these are unwelcome, and I can add
them to the `tool.ruff.lint.ignore` list:
- Several files have had minor changes made due to the stabilisations of
[`unsorted-dunder-all`](https://docs.astral.sh/ruff/rules/unsorted-dunder-all/)
(`RUF022`) and
[`unsorted-dunder-slots`](https://docs.astral.sh/ruff/rules/unsorted-dunder-slots/)
(`RUF023`)
- `src/scikit_build_core/builder/get_requires.py` has been changed
slightly due to the stabilisation of
[`parenthesize-chained-operators`](https://docs.astral.sh/ruff/rules/parenthesize-chained-operators/)
(`RUF021`)
  • Loading branch information
AlexWaygood authored Nov 22, 2024
1 parent 6330b42 commit 3943920
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ repos:
exclude: "^tests"

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.2
rev: v0.8.0
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -260,16 +260,13 @@ extend-select = [
]
ignore = [
"PLE1205", # Format check doesn't work with our custom logger
"PT004", # Incorrect, just usefixtures instead.
"PT013", # It's correct to import classes for typing!
"RUF009", # Too easy to get a false positive
"PYI025", # Wants Set to be renamed AbstractSet
"ISC001", # Conflicts with formatter
"PLR09", # Too many ...
"PLR2004", # Magic value used in comparison
"PLC0415", # Import should be at top of file
"ANN101", # Missing type annotation for `self` in method
"ANN102", # Missing type annotation for `cls` in classmethod
"ANN401", # Disallow dynamically typed expressions
"S101", # Use of assert detected
"S603", # subprocess untrusted input
Expand Down
2 changes: 1 addition & 1 deletion src/scikit_build_core/_compat/importlib/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
else:
from importlib.metadata import EntryPoints

__all__ = ["entry_points", "PathDistribution", "version"]
__all__ = ["PathDistribution", "entry_points", "version"]


def entry_points(*, group: str) -> EntryPoints:
Expand Down
6 changes: 3 additions & 3 deletions src/scikit_build_core/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
from . import __version__

__all__ = [
"LEVEL_VALUE",
"ScikitBuildLogger",
"Style",
"logger",
"raw_logger",
"rich_error",
"rich_print",
"rich_warning",
"rich_error",
"LEVEL_VALUE",
"Style",
]


Expand Down
4 changes: 2 additions & 2 deletions src/scikit_build_core/ast/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
if TYPE_CHECKING:
from collections.abc import Generator

__all__ = ["Node", "Block", "parse"]
__all__ = ["Block", "Node", "parse"]


def __dir__() -> list[str]:
Expand All @@ -20,7 +20,7 @@ def __dir__() -> list[str]:

@dataclasses.dataclass(frozen=True)
class Node:
__slots__ = ("name", "value", "start", "stop")
__slots__ = ("name", "start", "stop", "value")

name: str
value: str
Expand Down
2 changes: 1 addition & 1 deletion src/scikit_build_core/ast/tokenizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class TokenType(enum.Enum):

@dataclasses.dataclass(frozen=True)
class Token:
__slots__ = ("type", "start", "stop", "value")
__slots__ = ("start", "stop", "type", "value")

type: TokenType
start: int
Expand Down
2 changes: 1 addition & 1 deletion src/scikit_build_core/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ def prepare_metadata_for_build_editable(
).wheel_filename # actually returns the dist-info directory

__all__ += [
"prepare_metadata_for_build_wheel",
"prepare_metadata_for_build_editable",
"prepare_metadata_for_build_wheel",
]


Expand Down
6 changes: 2 additions & 4 deletions src/scikit_build_core/builder/get_requires.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,8 @@ def ninja(self) -> Generator[str, None, None]:
return

# On Windows MSVC, Ninja is not default
if (
self.settings.fail
or sysconfig.get_platform().startswith("win")
and use_ninja is None
if self.settings.fail or (
sysconfig.get_platform().startswith("win") and use_ninja is None
):
return

Expand Down

0 comments on commit 3943920

Please sign in to comment.