@@ -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 :
@@ -235,7 +255,7 @@ def sort_stream(
235
255
return changed
236
256
237
257
238
- def check_stream (
258
+ def check_stream ( # noqa: PLR0913
239
259
input_stream : TextIO ,
240
260
show_diff : Union [bool , TextIO ] = False ,
241
261
extension : Optional [str ] = None ,
@@ -255,6 +275,12 @@ def check_stream(
255
275
- **file_path**: The disk location where the code string was pulled from.
256
276
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
257
277
- ****config_kwargs**: Any config modifications.
278
+
279
+ Future modifications should consider refactoring to reduce complexity.
280
+
281
+ * There are currently 6 function argurments vs 5 recommended.
282
+
283
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
258
284
"""
259
285
config = _config (path = file_path , config = config , ** config_kwargs )
260
286
@@ -302,7 +328,7 @@ def check_stream(
302
328
return False
303
329
304
330
305
- def check_file (
331
+ def check_file ( # noqa: PLR0913
306
332
filename : Union [str , Path ],
307
333
show_diff : Union [bool , TextIO ] = False ,
308
334
config : Config = DEFAULT_CONFIG ,
@@ -322,6 +348,12 @@ def check_file(
322
348
- **disregard_skip**: set to `True` if you want to ignore a skip set in config for this file.
323
349
- **extension**: The file extension that contains imports. Defaults to filename extension or py.
324
350
- ****config_kwargs**: Any config modifications.
351
+
352
+ Future modifications should consider refactoring to reduce complexity.
353
+
354
+ * There are currently 6 function argurments vs 5 recommended.
355
+
356
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
325
357
"""
326
358
file_config : Config = config
327
359
@@ -366,7 +398,7 @@ def _file_output_stream_context(filename: Union[str, Path], source_file: File) -
366
398
# Ignore DeepSource cyclomatic complexity check for this function. It is one
367
399
# the main entrypoints so sort of expected to be complex.
368
400
# skipcq: PY-R1000
369
- def sort_file (
401
+ def sort_file ( # noqa: C901,PLR0913,PLR0912,PLR0915
370
402
filename : Union [str , Path ],
371
403
extension : Optional [str ] = None ,
372
404
config : Config = DEFAULT_CONFIG ,
@@ -393,6 +425,15 @@ def sort_file(
393
425
- **output**: If a TextIO is provided, results will be written there rather than replacing
394
426
the original file content.
395
427
- ****config_kwargs**: Any config modifications.
428
+
429
+ Future modifications should consider refactoring to reduce complexity.
430
+
431
+ * The McCabe cyclomatic complexity is currently 18 vs 10 recommended.
432
+ * There are currently 9 function argurments vs 5 recommended.
433
+ * There are currently 21 branches vs 12 recommended.
434
+ * There are currently 59 statements vs 50 recommended.
435
+
436
+ To revalidate these numbers, run `ruff check --select=C901,PLR091`.
396
437
"""
397
438
file_config : Config = config
398
439
0 commit comments