Skip to content

Commit 1502a96

Browse files
committed
Add a few more ruff rules
1 parent 47cc9c6 commit 1502a96

File tree

4 files changed

+23
-13
lines changed

4 files changed

+23
-13
lines changed

isort/output.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ def _with_straight_imports(
569569
) -> List[str]:
570570
output: List[str] = []
571571

572-
as_imports = any((module in parsed.as_map["straight"] for module in straight_modules))
572+
as_imports = any(module in parsed.as_map["straight"] for module in straight_modules)
573573

574574
# combine_straight_imports only works for bare imports, 'as' imports not included
575575
if config.combine_straight_imports and not as_imports:

pyproject.toml

+15-3
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,13 @@ lint.select = [
180180
"E",
181181
"F",
182182
"FLY",
183+
"PERF",
183184
"PIE",
185+
"PLC",
186+
"PLE",
187+
"RUF",
184188
"S",
189+
"UP",
185190
"W",
186191
]
187192
lint.ignore = [
@@ -190,14 +195,21 @@ lint.ignore = [
190195
"B904",
191196
"E203",
192197
"E501",
198+
"PERF203",
199+
"RUF100",
200+
"UP006",
201+
"UP035",
193202
]
194-
lint.exclude = [ "_vendored" ]
203+
lint.exclude = [ "isort/_vendored/*" ]
195204
lint.mccabe.max-complexity = 91 # Default is 10
196205

197206
[tool.ruff.lint.per-file-ignores]
207+
"isort/deprecated/finders.py" = [ "UP034" ]
198208
"isort/hooks.py" = [ "S603" ]
199-
"isort/settings.py" = [ "S603", "S607" ]
200-
"tests/*" = [ "S" ]
209+
"isort/output.py" = [ "PLC0206" ]
210+
"isort/settings.py" = [ "PLC0414", "S603", "S607" ]
211+
"isort/setuptools_commands.py" = [ "RUF012" ]
212+
"tests/*" = [ "RUF001", "S" ]
201213
"tests/unit/example_crlf_file.py" = [ "F401" ]
202214
"tests/unit/test_wrap_modes.py" = [ "PIE804" ]
203215

scripts/check_acknowledgments.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,11 @@ async def main():
4646
)
4747
results = response.json()
4848
contributors.extend(
49-
(
50-
contributor
51-
for contributor in results
52-
if contributor["type"] == GITHUB_USER_TYPE
53-
and contributor["login"] not in IGNORED_AUTHOR_LOGINS
54-
and f"@{contributor['login'].lower()}" not in ACKNOWLEDGEMENTS
55-
)
49+
contributor
50+
for contributor in results
51+
if contributor["type"] == GITHUB_USER_TYPE
52+
and contributor["login"] not in IGNORED_AUTHOR_LOGINS
53+
and f"@{contributor['login'].lower()}" not in ACKNOWLEDGEMENTS
5654
)
5755

5856
unacknowledged_users = await asyncio.gather(

tests/unit/test_isort.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3019,7 +3019,7 @@ def test_import_by_paren_issue_460() -> None:
30193019
import io
30203020
import os
30213021
"""
3022-
assert isort.code((test_input)) == test_input
3022+
assert isort.code(test_input) == test_input
30233023

30243024

30253025
def test_function_with_docstring() -> None:
@@ -3783,7 +3783,7 @@ def test_command_line(tmpdir, capfd, multiprocess: bool) -> None:
37833783

37843784
tmpdir.join("file1.py").write("import re\nimport os\n\nimport contextlib\n\n\nimport isort")
37853785
tmpdir.join("file2.py").write(
3786-
("import collections\nimport time\n\nimport abc" "\n\n\nimport isort")
3786+
"import collections\nimport time\n\nimport abc" "\n\n\nimport isort"
37873787
)
37883788
arguments = [str(tmpdir), "--settings-path", os.getcwd()]
37893789
if multiprocess:

0 commit comments

Comments
 (0)