diff options
Diffstat (limited to 'sbolint')
| -rwxr-xr-x | sbolint | 37 |
1 files changed, 37 insertions, 0 deletions
@@ -857,6 +857,40 @@ sub check_encoding { } } +sub check_empty_lines { + my $empties = 0; + + while(defined($_[0])) { + if($_[0] =~ /^\s*$/) { + $empties++; + } else { + last; + } + shift; + } + + return $empties; +} + +sub check_leading_empty_lines { + my $file = shift; + my $count = check_empty_lines(@_); + return unless $count; + log_error("$file begins with $count blank line" . ($count == 1 ? "" : "s")); +} + +sub check_trailing_empty_lines { + my $file = shift; + my $count = check_empty_lines(reverse @_); + return unless $count; + my $msg = "$file ends with $count blank line"; + if($count == 1) { + log_note($msg); + } else { + log_error($msg . "s"); + } +} + sub check_readme { my $maxlen = $ENV{'SBOLINT_README_MAX'} || 72; my @lines = check_and_read("README", 0644); @@ -868,6 +902,9 @@ sub check_readme { log_warning("README has tabs, these should be replaced with spaces"); } + check_leading_empty_lines('README', @lines); + check_trailing_empty_lines('README', @lines); + return if $suppress_readme_len; # 20220205 bkw: don't complain about long lines if they're URLs, |
