Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Ruff to 0.6.8 #1588

Merged
merged 3 commits into from
Nov 7, 2024
Merged
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 @@ -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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is safe currently because there is always a break after the deletion, but it would be preferable to do this safely rather than suppress the warning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we could simply extract i in the loop, then use ioutside the loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I change that in a different PR? Somehow I cannot get the fix right for now.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me take a quick crack at it...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will PR your branch soon later today with a rewrite, I have something working but I have some meetings.

# If there was only one marker then there will be an unnecessary
# trailing semicolon in the string representation
if not markers:
Expand Down
1 change: 1 addition & 0 deletions docs/.hooks/render_ruff_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def run(self, lines): # noqa: PLR6301
'PLR0915',
'PLR0916',
'PLR0917',
'PLR1701',
'PLR1702',
'PLR1706',
'PT004',
Expand Down
12 changes: 1 addition & 11 deletions ruff_defaults.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,12 @@ select = [
"A002",
"A003",
"ARG001",
"ARG001",
"ARG002",
"ARG003",
"ARG004",
"ARG005",
"ASYNC100",
"ASYNC101",
"ASYNC102",
"B002",
"B003",
"B004",
Expand Down Expand Up @@ -130,7 +129,6 @@ select = [
"E742",
"E743",
"E902",
"E999",
"EM101",
"EM102",
"EM103",
Expand Down Expand Up @@ -323,7 +321,6 @@ select = [
"PLR0203",
"PLR0206",
"PLR0402",
"PLR1701",
"PLR1704",
"PLR1711",
"PLR1714",
Expand Down Expand Up @@ -466,7 +463,6 @@ select = [
"RUF022",
"RUF023",
"RUF024",
"RUF025",
"RUF026",
"RUF027",
"RUF028",
Expand Down Expand Up @@ -590,11 +586,6 @@ select = [
"TID251",
"TID252",
"TID253",
"TRIO100",
"TRIO105",
"TRIO109",
"TRIO110",
"TRIO115",
"TRY002",
"TRY003",
"TRY004",
Expand Down Expand Up @@ -628,7 +619,6 @@ select = [
"UP024",
"UP025",
"UP026",
"UP027",
"UP028",
"UP029",
"UP030",
Expand Down
131 changes: 81 additions & 50 deletions src/hatch/cli/fmt/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -349,6 +368,7 @@ def get_config(self, section: str) -> dict[str, Any]:
'PERF102',
'PERF401',
'PERF402',
'PERF403',
'PGH005',
'PIE790',
'PIE794',
Expand All @@ -364,25 +384,37 @@ 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',
'PLE1300',
'PLE1307',
'PLE1310',
'PLE1507',
'PLE1519',
'PLE1520',
'PLE1700',
'PLE2502',
'PLE2510',
Expand All @@ -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',
Expand Down Expand Up @@ -485,7 +528,9 @@ def get_config(self, section: str) -> dict[str, Any]:
'PYI054',
'PYI055',
'PYI056',
'PYI057',
'PYI058',
'PYI062',
'RET503',
'RET504',
'RET505',
Expand All @@ -510,7 +555,10 @@ def get_config(self, section: str) -> dict[str, Any]:
'RUF018',
'RUF019',
'RUF020',
'RUF024',
'RUF026',
'RUF100',
'RUF101',
'S101',
'S102',
'S103',
Expand Down Expand Up @@ -563,6 +611,7 @@ def get_config(self, section: str) -> dict[str, Any]:
'S607',
'S608',
'S609',
'S610',
'S611',
'S612',
'S701',
Expand Down Expand Up @@ -615,11 +664,6 @@ def get_config(self, section: str) -> dict[str, Any]:
'TID251',
'TID252',
'TID253',
'TRIO100',
'TRIO105',
'TRIO109',
'TRIO110',
'TRIO115',
'TRY002',
'TRY003',
'TRY004',
Expand Down Expand Up @@ -685,14 +729,28 @@ 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',
'E116',
'E201',
'E202',
'E203',
'E204',
'E211',
'E221',
'E222',
Expand All @@ -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',
Expand All @@ -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]] = {
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.4.5'
RUFF_DEFAULT_VERSION: str = '0.6.8'
Loading