zip is called on several iterables without strict, so a length mismatch is silently cut off

tx0/python:zip-without-strictstrictnotebug

What it finds

zip stops at the shortest iterable, so if one list is shorter than expected the extra items of the others are dropped without notice. Since Python 3.10, strict=True makes a mismatch raise ValueError, and strict=False says that cutting off is meant. Reported are calls of the builtin zip with at least two arguments and no strict or **kwargs.

From the rule's source, zip_without_strict.rs.

Example from the rule's tests
def pair(names, values):    a = list(zip(names, values))tx0 reports: without strict, zip drops the extra items    b = list(zip(names, values, strict=True))    c = list(zip(names))    return a, b, c
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/python:zip-without-strict" = "note"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

# tx0: ignore[tx0/python:zip-without-strict] reason="..."

tx0 explain tx0/python:zip-without-strict shows the same in the terminal. Found a false positive? Report it.