From c9b8b254fef661046f868223b2663de17d8c9e7e 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.5.0 --- docs/.hooks/render_ruff_defaults.py | 1 + docs/history/hatch.md | 2 +- ruff_defaults.toml | 9 --- src/hatch/cli/fmt/core.py | 87 +++++++++++++---------- src/hatch/env/internal/static_analysis.py | 2 +- 5 files changed, 52 insertions(+), 49 deletions(-) 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 0eac19044..5b1408b23 100644 --- a/docs/history/hatch.md +++ b/docs/history/hatch.md @@ -27,7 +27,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.5.1 - Upgrade PyApp to 0.22.0 for binary builds ***Fixed:*** diff --git a/ruff_defaults.toml b/ruff_defaults.toml index 698e8e5a0..690e1f434 100644 --- a/ruff_defaults.toml +++ b/ruff_defaults.toml @@ -15,8 +15,6 @@ select = [ "ARG004", "ARG005", "ASYNC100", - "ASYNC101", - "ASYNC102", "B002", "B003", "B004", @@ -130,7 +128,6 @@ select = [ "E742", "E743", "E902", - "E999", "EM101", "EM102", "EM103", @@ -323,7 +320,6 @@ select = [ "PLR0203", "PLR0206", "PLR0402", - "PLR1701", "PLR1704", "PLR1711", "PLR1714", @@ -590,11 +586,6 @@ select = [ "TID251", "TID252", "TID253", - "TRIO100", - "TRIO105", - "TRIO109", - "TRIO110", - "TRIO115", "TRY002", "TRY003", "TRY004", diff --git a/src/hatch/cli/fmt/core.py b/src/hatch/cli/fmt/core.py index 8b079d89a..253cde18a 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,9 +384,12 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLC0205', 'PLC0208', 'PLC0414', + 'PLC2401', + 'PLC2403', 'PLC3002', 'PLE0100', 'PLE0101', + 'PLE0115', 'PLE0116', 'PLE0117', 'PLE0118', @@ -376,6 +399,9 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLE0307', 'PLE0604', 'PLE0605', + 'PLE0643', + 'PLE0704', + 'PLE1132', 'PLE1142', 'PLE1205', 'PLE1206', @@ -394,23 +420,31 @@ def get_config(self, section: str) -> dict[str, Any]: 'PLR0133', 'PLR0206', 'PLR0402', - 'PLR1701', + 'PLR1704', 'PLR1711', 'PLR1714', 'PLR1722', + 'PLR1736', 'PLR2004', + 'PLR2044', 'PLR5501', 'PLW0120', 'PLW0127', + 'PLW0128', 'PLW0129', 'PLW0131', + 'PLW0133', + 'PLW0245', 'PLW0406', 'PLW0602', 'PLW0603', + 'PLW0604', 'PLW0711', + 'PLW1501', 'PLW1508', 'PLW1509', 'PLW1510', + 'PLW2101', 'PLW2901', 'PLW3301', 'PT001', @@ -510,6 +544,8 @@ def get_config(self, section: str) -> dict[str, Any]: 'RUF018', 'RUF019', 'RUF020', + 'RUF024', + 'RUF026', 'RUF100', 'S101', 'S102', @@ -563,6 +599,7 @@ def get_config(self, section: str) -> dict[str, Any]: 'S607', 'S608', 'S609', + 'S610', 'S611', 'S612', 'S701', @@ -615,11 +652,6 @@ def get_config(self, section: str) -> dict[str, Any]: 'TID251', 'TID252', 'TID253', - 'TRIO100', - 'TRIO105', - 'TRIO109', - 'TRIO110', - 'TRIO115', 'TRY002', 'TRY003', 'TRY004', @@ -685,6 +717,8 @@ def get_config(self, section: str) -> dict[str, Any]: 'YTT303', ) PREVIEW_RULES: tuple[str, ...] = ( + 'ASYNC116', + 'B901', 'B909', 'E112', 'E113', @@ -717,87 +751,65 @@ def get_config(self, section: str) -> dict[str, Any]: 'E274', 'E275', 'E502', - 'FURB105', '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', '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', + 'PYI057', 'PYI059', 'PYI062', + 'PYI063', + 'PYI064', + 'PYI066', 'RUF021', 'RUF022', 'RUF023', - 'RUF024', 'RUF025', - 'RUF026', 'RUF027', 'RUF028', 'RUF029', + 'RUF030', 'RUF101', 'S401', 'S402', @@ -811,7 +823,6 @@ def get_config(self, section: str) -> dict[str, Any]: 'S412', 'S413', 'S415', - 'S610', 'UP042', 'W391', ) diff --git a/src/hatch/env/internal/static_analysis.py b/src/hatch/env/internal/static_analysis.py index c54895a8f..194b2bc52 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.5.0'