@@ -66,7 +66,7 @@ class ImportKey(Enum):
66
66
ALIAS = 4
67
67
68
68
69
- def sort_code_string (
69
+ def sort_code_string ( # noqa: PLR0913
70
70
code : str ,
71
71
extension : Optional [str ] = None ,
72
72
config : Config = DEFAULT_CONFIG ,
@@ -85,6 +85,12 @@ def sort_code_string(
85
85
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
86
86
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
87
87
- ****config_kwargs**: Any config modifications.
88
+
89
+ Future modifications should consider refactoring to reduce complexity.
90
+
91
+ * There are currently 6 function argurments vs 5 recommended.
92
+
93
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
88
94
"""
89
95
input_stream = StringIO (code )
90
96
output_stream = StringIO ()
@@ -102,7 +108,7 @@ def sort_code_string(
102
108
return output_stream .read ()
103
109
104
110
105
- def check_code_string (
111
+ def check_code_string ( # noqa: PLR0913
106
112
code : str ,
107
113
show_diff : Union [bool , TextIO ] = False ,
108
114
extension : Optional [str ] = None ,
@@ -122,6 +128,12 @@ def check_code_string(
122
128
- **file_path**: The disk location where the code string was pulled from.
123
129
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
124
130
- ****config_kwargs**: Any config modifications.
131
+
132
+ Future modifications should consider refactoring to reduce complexity.
133
+
134
+ * There are currently 6 function argurments vs 5 recommended.
135
+
136
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
125
137
"""
126
138
config = _config (path = file_path , config = config , ** config_kwargs )
127
139
return check_stream (
@@ -134,7 +146,7 @@ def check_code_string(
134
146
)
135
147
136
148
137
- def sort_stream (
149
+ def sort_stream ( # noqa: C901,PLR0913,PLR0912
138
150
input_stream : TextIO ,
139
151
output_stream : TextIO ,
140
152
extension : Optional [str ] = None ,
@@ -157,6 +169,14 @@ def sort_stream(
157
169
- **show_diff**: If `True` the changes that need to be done will be printed to stdout, if a
158
170
TextIO stream is provided results will be written to it, otherwise no diff will be computed.
159
171
- ****config_kwargs**: Any config modifications.
172
+
173
+ Future modifications should consider refactoring to reduce complexity.
174
+
175
+ * The McCabe cyclomatic complexity is currently 14 vs 10 recommended.
176
+ * There are currently 8 function argurments vs 5 recommended.
177
+ * There are currently 13 branches vs 12 recommended.
178
+
179
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
160
180
"""
161
181
extension = extension or (file_path and file_path .suffix .lstrip ("." )) or "py"
162
182
if show_diff :
@@ -237,7 +257,7 @@ def sort_stream(
237
257
return changed
238
258
239
259
240
- def check_stream (
260
+ def check_stream ( # noqa: PLR0913
241
261
input_stream : TextIO ,
242
262
show_diff : Union [bool , TextIO ] = False ,
243
263
extension : Optional [str ] = None ,
@@ -257,6 +277,12 @@ def check_stream(
257
277
- **file_path**: The disk location where the code string was pulled from.
258
278
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
259
279
- ****config_kwargs**: Any config modifications.
280
+
281
+ Future modifications should consider refactoring to reduce complexity.
282
+
283
+ * There are currently 6 function argurments vs 5 recommended.
284
+
285
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
260
286
"""
261
287
config = _config (path = file_path , config = config , ** config_kwargs )
262
288
@@ -304,7 +330,7 @@ def check_stream(
304
330
return False
305
331
306
332
307
- def check_file (
333
+ def check_file ( # noqa: PLR0913
308
334
filename : Union [str , Path ],
309
335
show_diff : Union [bool , TextIO ] = False ,
310
336
config : Config = DEFAULT_CONFIG ,
@@ -324,6 +350,12 @@ def check_file(
324
350
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
325
351
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
326
352
- ****config_kwargs**: Any config modifications.
353
+
354
+ Future modifications should consider refactoring to reduce complexity.
355
+
356
+ * There are currently 6 function argurments vs 5 recommended.
357
+
358
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
327
359
"""
328
360
file_config : Config = config
329
361
@@ -368,7 +400,7 @@ def _file_output_stream_context(filename: Union[str, Path], source_file: File) -
368
400
# Ignore DeepSource cyclomatic complexity check for this function. It is one
369
401
# the main entrypoints so sort of expected to be complex.
370
402
# skipcq: PY-R1000
371
- def sort_file (
403
+ def sort_file ( # noqa: C901,PLR0913,PLR0912,PLR0915
372
404
filename : Union [str , Path ],
373
405
extension : Optional [str ] = None ,
374
406
config : Config = DEFAULT_CONFIG ,
@@ -395,6 +427,15 @@ def sort_file(
395
427
- **output**: If a TextIO is provided, results will be written there rather than replacing
396
428
the original file content.
397
429
- ****config_kwargs**: Any config modifications.
430
+
431
+ Future modifications should consider refactoring to reduce complexity.
432
+
433
+ * The McCabe cyclomatic complexity is currently 18 vs 10 recommended.
434
+ * There are currently 9 function argurments vs 5 recommended.
435
+ * There are currently 21 branches vs 12 recommended.
436
+ * There are currently 59 statements vs 50 recommended.
437
+
438
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
398
439
"""
399
440
file_config : Config = config
400
441
0 commit comments