}
sub eol_detect {
- my ($content) = @_;
-
- my $cr = () = $content =~ /\r/g;
- my $lf = () = $content =~ /\n/g;
+ my ($cr, $lf) = @_;
if($cr > 0 && $lf == 0) {
return 'cr';
my $max_repeat_space = 79;
my $max_line_len = 192;
+my $max_lines = 10000;
my $max_path_len = 64;
my $max_filename_len = 48;
push @err, 'content: has tab';
}
- my $eol = eol_detect($content);
+ my $cnt_cr = () = $content =~ /\r/g;
+ my $cnt_lf = () = $content =~ /\n/g;
+
+ my $eol = eol_detect($cnt_cr, $cnt_lf);
if($eol eq '') {
push @err, 'content: has mixed EOL types';
push @err, 'content: must use LF EOL for this file type';
}
+ if($cnt_cr > $max_lines) {
+ push @err, sprintf('content: too many lines (%d > %d)', $cnt_cr, $max_lines);
+ }
+ elsif($cnt_lf > $max_lines) {
+ push @err, sprintf('content: too many lines (%d > %d)', $cnt_lf, $max_lines);
+ }
+
if($content =~ /[ \t]\n/) {
my $line;
for my $l (split(/\n/, $content)) {