From 068a182e61cbf11a5a6237047434877c5d786d44 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Sat, 29 Jun 2024 11:04:01 +0200 Subject: [PATCH] Upgrade Ruff to 0.6.8 --- backend/src/hatchling/metadata/spec.py | 2 +- docs/.hooks/render_ruff_defaults.py | 1 + docs/history/hatch.md | 2 +- ruff_defaults.toml | 12 +- src/hatch/cli/fmt/core.py | 131 +++++++++++++--------- src/hatch/env/internal/static_analysis.py | 2 +- 6 files changed, 86 insertions(+), 64 deletions(-) diff --git a/backend/src/hatchling/metadata/spec.py b/backend/src/hatchling/metadata/spec.py index 16cb6d1c5..a83ea3db1 100644 --- a/backend/src/hatchling/metadata/spec.py +++ b/backend/src/hatchling/metadata/spec.py @@ -174,7 +174,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] + del markers[i] # noqa: B909 # 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_ruff_defaults.py b/docs/.hooks/render_ruff_defaults.py index e6a73c373..8f4d0fdaf 100644 --- a/docs/.hooks/render_ruff_defaults.py +++ b/docs/.hooks/render_ruff_defaults.py @@ -270,6 +270,7 @@ def run(self, lines): # noqa: PLR6301 'PLR0915', 'PLR0916', 'PLR0917', + 'PLR1701', 'PLR1702', 'PLR1706', 'PT004', diff --git a/docs/history/hatch.md b/docs/history/hatch.md index cedeee268..44d9a55b9 100644 --- a/docs/history/hatch.md +++ b/docs/history/hatch.md @@ -28,7 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ***Added:*** - Add ability to control the source of Python distributions -- Upgrade Ruff to 0.4.5 +- Upgrade Ruff to 0.6.8 - Upgrade PyApp to 0.22.0 for binary builds ***Fixed:*** diff --git a/ruff_defaults.toml b/ruff_defaults.toml index 698e8e5a0..9acc585a3 100644 --- a/ruff_defaults.toml +++ b/ruff_defaults.toml @@ -10,13 +10,12 @@ select = [ "A002", "A003", "ARG001", + "ARG001", "ARG002", "ARG003", "ARG004", "ARG005", "ASYNC100", - "ASYNC101", - "ASYNC102", "B002", "B003", "B004", @@ -130,7 +129,6 @@ select = [ "E742", "E743", "E902", - "E999", "EM101", "EM102", "EM103", @@ -323,7 +321,6 @@ select = [ "PLR0203", "PLR0206", "PLR0402", - "PLR1701", "PLR1704", "PLR1711", "PLR1714", @@ -466,7 +463,6 @@ select = [ "RUF022", "RUF023", "RUF024", - "RUF025", "RUF026", "RUF027", "RUF028", @@ -590,11 +586,6 @@ select = [ "TID251", "TID252", "TID253", - "TRIO100", - "TRIO105", - "TRIO109", - "TRIO110", - "TRIO115", "TRY002", "TRY003", "TRY004", @@ -628,7 +619,6 @@ select = [ "UP024", "UP025", "UP026", - "UP027", "UP028", "UP029", "UP030", diff --git a/src/hatch/cli/fmt/core.py b/src/hatch/cli/fmt/core.py index 8b079d89a..de454a342 100644 --- a/src/hatch/cli/fmt/core.py +++ b/src/hatch/cli/fmt/core.py @@ -167,8 +167,16 @@ def get_config(self, section: str) -> dict[str, Any]: 'ARG004', 'ARG005', 'ASYNC100', - 'ASYNC101', - 'ASYNC102', + 'ASYNC105', + 'ASYNC109', + 'ASYNC110', + 'ASYNC115', + 'ASYNC210', + 'ASYNC220', + 'ASYNC221', + 'ASYNC222', + 'ASYNC230', + 'ASYNC251', 'B002', 'B003', 'B004', @@ -307,6 +315,17 @@ def get_config(self, section: str) -> dict[str, Any]: 'FBT001', 'FBT002', 'FLY002', + 'FURB105', + 'FURB129', + 'FURB136', + 'FURB161', + 'FURB163', + 'FURB167', + 'FURB168', + 'FURB169', + 'FURB177', + 'FURB181', + 'FURB187', 'G001', 'G002', 'G003', @@ -349,6 +368,7 @@ def get_config(self, section: str) -> dict[str, Any]: 'PERF102', 'PERF401', 'PERF402', + 'PERF403', 'PGH005', 'PIE790', 'PIE794', @@ -364,18 +384,28 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLC0205', 'PLC0208', 'PLC0414', + 'PLC2401', + 'PLC2403', 'PLC3002', 'PLE0100', 'PLE0101', + 'PLE0115', 'PLE0116', 'PLE0117', 'PLE0118', 'PLE0237', 'PLE0241', 'PLE0302', + 'PLE0303', + 'PLE0305', 'PLE0307', + 'PLE0308', + 'PLE0309', 'PLE0604', 'PLE0605', + 'PLE0643', + 'PLE0704', + 'PLE1132', 'PLE1142', 'PLE1205', 'PLE1206', @@ -383,6 +413,8 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLE1307', 'PLE1310', 'PLE1507', + 'PLE1519', + 'PLE1520', 'PLE1700', 'PLE2502', 'PLE2510', @@ -394,23 +426,34 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLR0133', 'PLR0206', 'PLR0402', - 'PLR1701', + 'PLR1704', 'PLR1711', 'PLR1714', 'PLR1722', + 'PLR1730', + 'PLR1736', 'PLR2004', + 'PLR2044', 'PLR5501', 'PLW0120', 'PLW0127', + 'PLW0128', 'PLW0129', 'PLW0131', + 'PLW0133', + 'PLW0211', + 'PLW0245', 'PLW0406', 'PLW0602', 'PLW0603', + 'PLW0604', + 'PLW0642', 'PLW0711', + 'PLW1501', 'PLW1508', 'PLW1509', 'PLW1510', + 'PLW2101', 'PLW2901', 'PLW3301', 'PT001', @@ -485,7 +528,9 @@ def get_config(self, section: str) -> dict[str, Any]: 'PYI054', 'PYI055', 'PYI056', + 'PYI057', 'PYI058', + 'PYI062', 'RET503', 'RET504', 'RET505', @@ -510,7 +555,10 @@ def get_config(self, section: str) -> dict[str, Any]: 'RUF018', 'RUF019', 'RUF020', + 'RUF024', + 'RUF026', 'RUF100', + 'RUF101', 'S101', 'S102', 'S103', @@ -563,6 +611,7 @@ def get_config(self, section: str) -> dict[str, Any]: 'S607', 'S608', 'S609', + 'S610', 'S611', 'S612', 'S701', @@ -615,11 +664,6 @@ def get_config(self, section: str) -> dict[str, Any]: 'TID251', 'TID252', 'TID253', - 'TRIO100', - 'TRIO105', - 'TRIO109', - 'TRIO110', - 'TRIO115', 'TRY002', 'TRY003', 'TRY004', @@ -685,7 +729,20 @@ def get_config(self, section: str) -> dict[str, Any]: 'YTT303', ) PREVIEW_RULES: tuple[str, ...] = ( + 'A004', + 'A005', + 'A006', + 'ASYNC116', + 'B039', + 'B901', 'B909', + 'C420', + 'DOC201', + 'DOC202', + 'DOC402', + 'DOC403', + 'DOC501', + 'DOC502', 'E112', 'E113', 'E115', @@ -693,6 +750,7 @@ def get_config(self, section: str) -> dict[str, Any]: 'E201', 'E202', 'E203', + 'E204', 'E211', 'E221', 'E222', @@ -717,88 +775,61 @@ def get_config(self, section: str) -> dict[str, Any]: 'E274', 'E275', 'E502', - 'FURB105', + 'FAST001', + 'FAST002', + 'FAST003', 'FURB110', 'FURB113', 'FURB116', 'FURB118', - 'FURB129', 'FURB131', 'FURB132', - 'FURB136', 'FURB142', 'FURB145', 'FURB148', 'FURB152', + 'FURB154', 'FURB157', - 'FURB161', - 'FURB163', 'FURB164', 'FURB166', - 'FURB167', - 'FURB168', - 'FURB169', 'FURB171', - 'FURB177', 'FURB180', - 'FURB181', - 'FURB187', + 'FURB188', 'FURB192', - 'PERF403', + 'PLC0206', 'PLC0415', 'PLC1901', - 'PLC2401', - 'PLC2403', 'PLC2701', 'PLC2801', - 'PLE0115', - 'PLE0303', 'PLE0304', - 'PLE0305', - 'PLE0308', - 'PLE0309', - 'PLE0643', - 'PLE0704', - 'PLE1132', 'PLE1141', - 'PLE1519', - 'PLE1520', 'PLE4703', 'PLR0202', 'PLR0203', - 'PLR1704', - 'PLR1730', 'PLR1733', - 'PLR1736', - 'PLR2044', 'PLR6104', 'PLR6201', 'PLR6301', 'PLW0108', - 'PLW0128', - 'PLW0133', 'PLW0177', - 'PLW0211', - 'PLW0245', - 'PLW0604', - 'PLW0642', - 'PLW1501', 'PLW1514', 'PLW1641', - 'PLW2101', 'PLW3201', 'PYI059', - 'PYI062', + 'PYI063', + 'PYI064', + 'PYI066', 'RUF021', 'RUF022', 'RUF023', - 'RUF024', - 'RUF025', - 'RUF026', 'RUF027', 'RUF028', 'RUF029', - 'RUF101', + 'RUF030', + 'RUF031', + 'RUF032', + 'RUF033', + 'RUF034', 'S401', 'S402', 'S403', @@ -811,8 +842,8 @@ def get_config(self, section: str) -> dict[str, Any]: 'S412', 'S413', 'S415', - 'S610', 'UP042', + 'UP043', '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 c54895a8f..f860a8a6e 100644 --- a/src/hatch/env/internal/static_analysis.py +++ b/src/hatch/env/internal/static_analysis.py @@ -17,4 +17,4 @@ def get_default_config() -> dict[str, Any]: } -RUFF_DEFAULT_VERSION: str = '0.4.5' +RUFF_DEFAULT_VERSION: str = '0.6.7'