Repository navigation
Add is_binary_data flag to detect binary data files in text form - #5571
Open
sujalgiriiitp-source wants to merge 1 commit into
Open
sujalgiriiitp-source wants to merge 1 commit into
sujalgiriiitp-source wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Detect common binary data files in hex form as a new informational
is_binary_dataflag in the--infoscan, as suggested in #602. Intel HEX files are detected by validating the record structure (byte count, record type 00-05) and checksum of each line. Pure hex/number data files (long lists of hex digits and numbers) are detected when all sampled lines consist only of hex digits, digits,X, punctuation or whitespace. Only the first 200 non-empty lines are read, so large data files stay cheap to check. This is detection only: flagged files are still scanned, since hex firmwares are known to carry unusual licenses. Skipping the scan of such files is left for later work, as is certificate detection (#620). Fixes #602 (partial: implements TODO item 1, theis_binary_dataflag; skipping is explicitly out of scope). Tests: newTestBinaryDatatests intests/textcode/test_analysis.pyandget_file_infocoverage intests/scancode/test_api.py(39 passed). A false-positive check over 64,815 existing source/test-data files flagged only the new fixtures. AI use disclosure (per AboutCode's draft AI-policy direction — Sujal to confirm wording before submitting): this change was drafted with AI assistance and reviewed/verified by me (Sujal Giri) before submission.