Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/hatchling/metadata/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion docs/.hooks/render_default_test_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
8 changes: 7 additions & 1 deletion docs/.hooks/render_ruff_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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",
Expand Down Expand Up @@ -217,6 +222,7 @@ def run(self, lines): # noqa: PLR6301
"D417",
"D418",
"D419",
"D420",
"DJ001",
"DJ003",
"DJ006",
Expand Down
10 changes: 5 additions & 5 deletions scripts/update_ruff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("}")

Expand All @@ -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("")
Expand Down
42 changes: 28 additions & 14 deletions src/hatch/cli/fmt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -227,6 +230,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"B904",
"B905",
"B911",
"B912",
"BLE001",
"C400",
"C401",
Expand Down Expand Up @@ -335,6 +339,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"FBT002",
"FLY002",
"FURB105",
"FURB110",
"FURB116",
"FURB122",
"FURB129",
Expand All @@ -348,6 +353,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"FURB167",
"FURB168",
"FURB169",
"FURB171",
"FURB177",
"FURB181",
"FURB187",
Expand Down Expand Up @@ -411,6 +417,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"PLC0132",
"PLC0205",
"PLC0206",
"PLC0207",
"PLC0208",
"PLC0414",
"PLC0415",
Expand Down Expand Up @@ -468,6 +475,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"PLR2004",
"PLR2044",
"PLR5501",
"PLW0108",
"PLW0120",
"PLW0127",
"PLW0128",
Expand Down Expand Up @@ -609,6 +617,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"RUF032",
"RUF033",
"RUF034",
"RUF037",
"RUF040",
"RUF041",
"RUF043",
Expand All @@ -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",
Expand Down Expand Up @@ -776,6 +791,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"UP039",
"UP040",
"UP041",
"UP042",
"UP043",
"UP044",
"UP045",
Expand All @@ -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",
Expand Down Expand Up @@ -845,7 +859,6 @@ def get_config(self, section: str) -> dict[str, Any]:
"E274",
"E275",
"E502",
"FURB110",
"FURB113",
"FURB118",
"FURB131",
Expand All @@ -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",
Expand All @@ -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",
Expand All @@ -882,7 +895,6 @@ def get_config(self, section: str) -> dict[str, Any]:
"RUF029",
"RUF031",
"RUF036",
"RUF037",
"RUF038",
"RUF039",
"RUF045",
Expand All @@ -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",
Expand All @@ -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]] = {
Expand Down
2 changes: 1 addition & 1 deletion src/hatch/env/internal/static_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
1 change: 0 additions & 1 deletion src/hatch/project/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading