aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-05-21 05:20:12 -0400
committerB. Watson <urchlay@slackware.uk>2026-05-21 05:20:12 -0400
commit2757490477b9f3ecca4a4f14434815ca338e70ae (patch)
tree6001073cc0a2f1556ef613fe6a873266216c8957
parent54db3539d128da3cb6f0c7a677ee55e01384b377 (diff)
downloadsbo-maintainer-tools-2757490477b9f3ecca4a4f14434815ca338e70ae.tar.gz
Add check for leading or trailing blank lines in README, per mailing list.
-rwxr-xr-xsbolint37
1 files changed, 37 insertions, 0 deletions
diff --git a/sbolint b/sbolint
index 05b8ba0..f975cdd 100755
--- a/sbolint
+++ b/sbolint
@@ -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,