loop_threshold
Type: int
Default: 10
Description
Controls when rules L001, L002, and L003 fire for for loops.
forloops — only flagged whenrange(N)exceedsloop_threshold. A loop overrange(3)with threshold10is not flagged.whileloops — always assumed to run 99 iterations and are always flagged regardless of this threshold.
Example
[tool.pyspark-antipattern]
# Only flag for-loops that could run more than 50 iterations
loop_threshold = 50
Notes
Info
while loops are always flagged because their iteration count cannot be statically determined — the worst case is assumed.