diff --git a/backend/src/hatchling/metadata/spec.py b/backend/src/hatchling/metadata/spec.py index 350caec97..b56d60d71 100644 --- a/backend/src/hatchling/metadata/spec.py +++ b/backend/src/hatchling/metadata/spec.py @@ -182,7 +182,7 @@ def project_metadata_from_core_metadata(core_metadata: str) -> dict[str, Any]: left, _, right = marker if left.value == "extra": extra = right.value - del markers[i] # noqa: B909 + del markers[i] # If there was only one marker then there will be an unnecessary # trailing semicolon in the string representation if not markers: diff --git a/docs/.hooks/render_default_test_env.py b/docs/.hooks/render_default_test_env.py index 7813d6fbf..0a2431e75 100644 --- a/docs/.hooks/render_default_test_env.py +++ b/docs/.hooks/render_default_test_env.py @@ -51,7 +51,8 @@ def get_scripts_toml(): class TestEnvDefaultsPreprocessor(Preprocessor): def run(self, lines): # noqa: PLR6301 return ( - "\n".join(lines) + "\n" + .join(lines) .replace(MARKER_DEPENDENCIES, get_dependencies_toml()) .replace(MARKER_MATRIX, get_matrix_toml()) .replace(MARKER_SCRIPTS, get_scripts_toml()) diff --git a/docs/.hooks/render_ruff_defaults.py b/docs/.hooks/render_ruff_defaults.py index 748c82cf0..acdd54df2 100644 --- a/docs/.hooks/render_ruff_defaults.py +++ b/docs/.hooks/render_ruff_defaults.py @@ -136,7 +136,8 @@ def get_per_file_ignored_rules(): class RuffDefaultsPreprocessor(Preprocessor): def run(self, lines): # noqa: PLR6301 return ( - "\n".join(lines) + "\n" + .join(lines) .replace(MARKER_VERSION, get_ruff_version()) .replace(MARKER_STABLE_RULES_COUNT, get_stable_rules_count()) .replace(MARKER_PREVIEW_RULES_COUNT, get_preview_rules_count()) @@ -151,10 +152,14 @@ def run(self, lines): # noqa: PLR6301 UNSELECTED_RULES: tuple[str, ...] = ( "AIR001", "AIR002", + "AIR003", "AIR301", "AIR302", + "AIR303", + "AIR304", "AIR311", "AIR312", + "AIR321", "ANN001", "ANN002", "ANN003", @@ -217,6 +222,7 @@ def run(self, lines): # noqa: PLR6301 "D417", "D418", "D419", + "D420", "DJ001", "DJ003", "DJ006", diff --git a/scripts/update_ruff.py b/scripts/update_ruff.py index d527d9e60..173d28bb0 100644 --- a/scripts/update_ruff.py +++ b/scripts/update_ruff.py @@ -123,17 +123,17 @@ def main(): stable_rules.add(code) lines.append("STABLE_RULES: tuple[str, ...] = (") - lines.extend(f" {rule!r}," for rule in sorted(stable_rules)) + lines.extend(f' "{rule}",' for rule in sorted(stable_rules)) lines.append(")") lines.append("PREVIEW_RULES: tuple[str, ...] = (") - lines.extend(f" {rule!r}," for rule in sorted(preview_rules)) + lines.extend(f' "{rule}",' for rule in sorted(preview_rules)) lines.append(")") lines.append("PER_FILE_IGNORED_RULES: dict[str, list[str]] = {") for ignored_glob, ignored_rules in sorted(PER_FILE_IGNORED_RULES.items()): - lines.append(f" {ignored_glob!r}: [") - lines.extend(f" {rule!r}," for rule in sorted(ignored_rules)) + lines.append(f' "{ignored_glob}": [') + lines.extend(f' "{rule}",' for rule in sorted(ignored_rules)) lines.append(" ],") lines.append("}") @@ -157,7 +157,7 @@ def main(): lines = get_lines_until(data_file, "UNSELECTED_RULES") lines.append("UNSELECTED_RULES: tuple[str, ...] = (") - lines.extend(f" {rule!r}," for rule in sorted(unselected_rules)) + lines.extend(f' "{rule}",' for rule in sorted(unselected_rules)) lines.append(")") lines.append("") diff --git a/src/hatch/cli/fmt/core.py b/src/hatch/cli/fmt/core.py index 8627c2b1b..a4d15990b 100644 --- a/src/hatch/cli/fmt/core.py +++ b/src/hatch/cli/fmt/core.py @@ -185,10 +185,13 @@ def get_config(self, section: str) -> dict[str, Any]: "ASYNC115", "ASYNC116", "ASYNC210", + "ASYNC212", "ASYNC220", "ASYNC221", "ASYNC222", "ASYNC230", + "ASYNC240", + "ASYNC250", "ASYNC251", "B002", "B003", @@ -227,6 +230,7 @@ def get_config(self, section: str) -> dict[str, Any]: "B904", "B905", "B911", + "B912", "BLE001", "C400", "C401", @@ -335,6 +339,7 @@ def get_config(self, section: str) -> dict[str, Any]: "FBT002", "FLY002", "FURB105", + "FURB110", "FURB116", "FURB122", "FURB129", @@ -348,6 +353,7 @@ def get_config(self, section: str) -> dict[str, Any]: "FURB167", "FURB168", "FURB169", + "FURB171", "FURB177", "FURB181", "FURB187", @@ -411,6 +417,7 @@ def get_config(self, section: str) -> dict[str, Any]: "PLC0132", "PLC0205", "PLC0206", + "PLC0207", "PLC0208", "PLC0414", "PLC0415", @@ -468,6 +475,7 @@ def get_config(self, section: str) -> dict[str, Any]: "PLR2004", "PLR2044", "PLR5501", + "PLW0108", "PLW0120", "PLW0127", "PLW0128", @@ -609,6 +617,7 @@ def get_config(self, section: str) -> dict[str, Any]: "RUF032", "RUF033", "RUF034", + "RUF037", "RUF040", "RUF041", "RUF043", @@ -620,8 +629,14 @@ def get_config(self, section: str) -> dict[str, Any]: "RUF057", "RUF058", "RUF059", + "RUF060", + "RUF061", + "RUF064", "RUF100", "RUF101", + "RUF102", + "RUF103", + "RUF104", "S101", "S102", "S103", @@ -776,6 +791,7 @@ def get_config(self, section: str) -> dict[str, Any]: "UP039", "UP040", "UP041", + "UP042", "UP043", "UP044", "UP045", @@ -800,13 +816,11 @@ def get_config(self, section: str) -> dict[str, Any]: "YTT303", ) PREVIEW_RULES: tuple[str, ...] = ( - "ASYNC212", - "ASYNC240", - "ASYNC250", + "B043", "B901", "B903", "B909", - "B912", + "DOC102", "DOC201", "DOC202", "DOC402", @@ -845,7 +859,6 @@ def get_config(self, section: str) -> dict[str, Any]: "E274", "E275", "E502", - "FURB110", "FURB113", "FURB118", "FURB131", @@ -856,12 +869,11 @@ def get_config(self, section: str) -> dict[str, Any]: "FURB154", "FURB156", "FURB164", - "FURB171", "FURB180", "FURB189", "FURB192", + "ISC004", "LOG004", - "PLC0207", "PLC1901", "PLC2701", "PLC2801", @@ -870,10 +882,11 @@ def get_config(self, section: str) -> dict[str, Any]: "PLE4703", "PLR0202", "PLR0203", + "PLR1708", + "PLR1712", "PLR6104", "PLR6201", "PLR6301", - "PLW0108", "PLW0244", "PLW1514", "PLW3201", @@ -882,7 +895,6 @@ def get_config(self, section: str) -> dict[str, Any]: "RUF029", "RUF031", "RUF036", - "RUF037", "RUF038", "RUF039", "RUF045", @@ -891,12 +903,14 @@ def get_config(self, section: str) -> dict[str, Any]: "RUF054", "RUF055", "RUF056", - "RUF060", - "RUF061", "RUF063", - "RUF064", "RUF065", - "RUF102", + "RUF066", + "RUF067", + "RUF068", + "RUF069", + "RUF070", + "RUF071", "S401", "S402", "S403", @@ -910,7 +924,7 @@ def get_config(self, section: str) -> dict[str, Any]: "S413", "S415", "TC008", - "UP042", + "TID254", "W391", ) PER_FILE_IGNORED_RULES: dict[str, list[str]] = { diff --git a/src/hatch/env/internal/static_analysis.py b/src/hatch/env/internal/static_analysis.py index 98c16495d..da30c64f2 100644 --- a/src/hatch/env/internal/static_analysis.py +++ b/src/hatch/env/internal/static_analysis.py @@ -41,4 +41,4 @@ def get_check_fmt_config() -> dict[str, Any]: } -RUFF_DEFAULT_VERSION: str = "0.13.2" +RUFF_DEFAULT_VERSION: str = "0.15.22" diff --git a/src/hatch/project/core.py b/src/hatch/project/core.py index cd9849681..1f64dde2d 100644 --- a/src/hatch/project/core.py +++ b/src/hatch/project/core.py @@ -2,7 +2,6 @@ import re from collections import defaultdict -from collections.abc import Generator from contextlib import contextmanager from functools import cached_property from typing import TYPE_CHECKING, Any, cast