Reproducible five-finding Python code review by Merlijn LindersReproducible five-finding Python code review by Merlijn Linders

Reproducible five-finding Python code review

Merlijn Linders

Merlijn Linders

High

Export path escapes its base

sample_before.py:9
A parent-relative filename resolves outside the configured export directory. The fix resolves and constrains the candidate path.
Medium

Mutable default shares state

sample_before.py:12–15
Tags leak between otherwise independent calls. The fix allocates a new list for each default call.
Medium

Zero total crashes calculation

sample_before.py:20
An empty dataset raises an unexpected division error. The fix validates the total and reports a descriptive error.
Medium

Negative quantities pass validation

sample_before.py:25–27
Invalid negative values enter the domain unchanged. The fix rejects them immediately.
Low

CSV fields are not escaped

sample_before.py:31
A comma inside a value changes the apparent column count. The fix delegates serialization to the standard CSV writer.

Run the evidence locally

Like this project

Posted Jul 29, 2026

Five exact file-and-line findings, executable reproduction, corrected code, and seven passing regression tests.