spacecheck: cap number of lines per file - #22387
Closed
vszakats wants to merge 3 commits into
Closed
Conversation
To prevent merging large text files by accident.
There was a problem hiding this comment.
Pull request overview
This PR updates scripts/spacecheck.pl to reduce the risk of accidentally committing/merging extremely large text files by adding a per-file maximum line-count check.
Changes:
- Refactors
eol_detect()to use precomputed CR/LF counts instead of scanning content internally. - Adds a
max_linesthreshold (10,000) and reports an error when exceeded. - Adjusts the mixed-EOL error text to hint at possible binary content.
Comments suppressed due to low confidence (1)
scripts/spacecheck.pl:144
- After removing the unused
$contentparameter fromeol_detect(), update this call site to pass only the CR/LF counts.
my $eol = eol_detect($content, $cnt_cr, $cnt_lf);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as outdated.
This comment was marked as outdated.
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.
To prevent merging large text files by accident.
Set the cap at 10k lines. The current line number top list is: