Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore large data files and bump scancode-toolkit #1508

Merged
merged 13 commits into from
Jan 21, 2025
Merged

Conversation

AyanSinhaMahapatra
Copy link
Member

@AyanSinhaMahapatra AyanSinhaMahapatra commented Jan 6, 2025

This PR:

Ignore scanning large data files which are larger than 1 MB
to avoid crashing scans on memory spikes.
Also rollback #1504

Reference: aboutcode-org/scancode-toolkit#3711
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
Also remove platform constraints from rust-inspector and
go-inspector.

Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@pombredanne
Copy link
Member

we will need some tests later.

Copy link
Contributor

@tdruez tdruez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of hardcoded values, SKIP_DATA_FILE_SIZE should be a SCIO setting, similar to SCANCODEIO_SCAN_FILE_TIMEOUT, off by default. Also, I don't think the SKIP_DATA_FILE_EXTENSIONS is relevant.

I would suggest adding a SCANCODEIO_SCAN_MAX_FILE_SIZE, default to None. This is the least intrusive way and will stay useful in the future.

scanpipe/pipes/scancode.py Outdated Show resolved Hide resolved
@AyanSinhaMahapatra
Copy link
Member Author

@tdruez I've added a SCANCODEIO_SCAN_MAX_FILE_SIZE as suggested by you since this seemed less problematic, this is ready for review.

Copy link
Contributor

@tdruez tdruez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, ready to merge once the couple small issues are addressed.

scanpipe/pipes/flag.py Outdated Show resolved Hide resolved
scanpipe/tests/pipes/test_scancode.py Outdated Show resolved Hide resolved
setup.cfg Outdated Show resolved Hide resolved
Copy link
Member

@pombredanne pombredanne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO we should have a scancod-config entry for this parameter, otherwise this requires changing the installation settings. This could be a follow up issue.

Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
Copy link
Contributor

@tdruez tdruez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AyanSinhaMahapatra The code looks good.
We are missing a changelog entry and to update the https://scancodeio.readthedocs.io/en/latest/project-configuration.html with the new setting.

@AyanSinhaMahapatra
Copy link
Member Author

Thanks for the reviews @tdruez and @pombredanne, all addressed and ready now!

@tdruez tdruez merged commit 1275d07 into main Jan 21, 2025
9 checks passed
@tdruez tdruez deleted the ignore-large-json branch January 21, 2025 12:04
@tdruez
Copy link
Contributor

tdruez commented Jan 21, 2025

@AyanSinhaMahapatra Looks great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants