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
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
4 changes: 3 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 @@ -153,6 +154,7 @@ def run(self, lines): # noqa: PLR6301
"AIR002",
"AIR301",
"AIR302",
"AIR303",
"AIR311",
"AIR312",
"ANN001",
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
36 changes: 22 additions & 14 deletions src/hatch/cli/fmt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,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 @@ -218,6 +221,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"B904",
"B905",
"B911",
"B912",
"BLE001",
"C400",
"C401",
Expand Down Expand Up @@ -326,6 +330,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"FBT002",
"FLY002",
"FURB105",
"FURB110",
"FURB116",
"FURB122",
"FURB129",
Expand All @@ -339,6 +344,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"FURB167",
"FURB168",
"FURB169",
"FURB171",
"FURB177",
"FURB181",
"FURB187",
Expand Down Expand Up @@ -402,6 +408,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"PLC0132",
"PLC0205",
"PLC0206",
"PLC0207",
"PLC0208",
"PLC0414",
"PLC0415",
Expand Down Expand Up @@ -459,6 +466,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"PLR2004",
"PLR2044",
"PLR5501",
"PLW0108",
"PLW0120",
"PLW0127",
"PLW0128",
Expand Down Expand Up @@ -600,6 +608,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"RUF032",
"RUF033",
"RUF034",
"RUF037",
"RUF040",
"RUF041",
"RUF043",
Expand All @@ -611,8 +620,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 @@ -767,6 +782,7 @@ def get_config(self, section: str) -> dict[str, Any]:
"UP039",
"UP040",
"UP041",
"UP042",
"UP043",
"UP044",
"UP045",
Expand All @@ -791,13 +807,10 @@ def get_config(self, section: str) -> dict[str, Any]:
"YTT303",
)
PREVIEW_RULES: tuple[str, ...] = (
"ASYNC212",
"ASYNC240",
"ASYNC250",
"B901",
"B903",
"B909",
"B912",
"DOC102",
"DOC201",
"DOC202",
"DOC402",
Expand Down Expand Up @@ -836,7 +849,6 @@ def get_config(self, section: str) -> dict[str, Any]:
"E274",
"E275",
"E502",
"FURB110",
"FURB113",
"FURB118",
"FURB131",
Expand All @@ -847,12 +859,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 @@ -861,10 +872,10 @@ def get_config(self, section: str) -> dict[str, Any]:
"PLE4703",
"PLR0202",
"PLR0203",
"PLR1708",
"PLR6104",
"PLR6201",
"PLR6301",
"PLW0108",
"PLW0244",
"PLW1514",
"PLW3201",
Expand All @@ -873,7 +884,6 @@ def get_config(self, section: str) -> dict[str, Any]:
"RUF029",
"RUF031",
"RUF036",
"RUF037",
"RUF038",
"RUF039",
"RUF045",
Expand All @@ -882,12 +892,11 @@ def get_config(self, section: str) -> dict[str, Any]:
"RUF054",
"RUF055",
"RUF056",
"RUF060",
"RUF061",
"RUF063",
"RUF064",
"RUF065",
"RUF102",
"RUF066",
"RUF067",
"RUF068",
"S401",
"S402",
"S403",
Expand All @@ -901,7 +910,6 @@ def get_config(self, section: str) -> dict[str, Any]:
"S413",
"S415",
"TC008",
"UP042",
"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 @@ -17,4 +17,4 @@ def get_default_config() -> dict[str, Any]:
}


RUFF_DEFAULT_VERSION: str = "0.13.2"
RUFF_DEFAULT_VERSION: str = "0.15.0"
Loading