Fix flag_and_ignore_files_over_max_size inconsistent return value and docstring
What
Fix flag_and_ignore_files_over_max_size in scanpipe/pipes/flag.py which had a misleading docstring and an implicit return value.
Why
The docstring claimed the function would: > "return all other files within the file size limit"
But .update() returns an integer (count of updated rows), not a queryset. This is inconsistent and confusing for anyone reading the code.
Evidence that the return value was misleading — the caller in scanpipe/pipes/scancode.py ignores the return value and manually
re-filters:
resource_qs.filter(~Q(status=flag.IGNORED_BY_MAX_FILE_SIZE))
Fix
- Explicitly assign
.update()result toflagged_countvariable - Return
flagged_countclearly - Update docstring to accurately say it returns the count of flagged files
- Add regression tests to verify return type and correct flagging behavior
Files changed
scanpipe/pipes/flag.py— fix return value + docstringscanpipe/tests/pipes/test_flag.py— add two regression tests
Hi maintainers! This PR fixes an inconsistent return value and misleading docstring in flag_and_ignore_files_over_max_size.
Would love to get your feedback when you have a chance. Happy to make any changes needed. Thank you!