aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2020-11-25 21:49:13 -0500
committerB. Watson <yalhcru@gmail.com>2020-11-25 21:49:13 -0500
commiteab14134c1a95b4bc5b58cbe534e6171811b1329 (patch)
tree7bb66a88b398379564f3456ccc5e823f6fac771c
parent5cc52f5f3bfb04aa02bcb99554fc739b50110951 (diff)
downloadsbostuff-eab14134c1a95b4bc5b58cbe534e6171811b1329.tar.gz
sbolint: enforce 72-char limit in README
-rwxr-xr-xsbolint14
1 files changed, 13 insertions, 1 deletions
diff --git a/sbolint b/sbolint
index 0fb6e3d..0c70e61 100755
--- a/sbolint
+++ b/sbolint
@@ -142,6 +142,11 @@ For all builds:
=item -
+The SlackBuild, .info, README files must have Unix \n line endings (not
+DOS \r\n), and the last line of each must have a \n.
+
+=item -
+
The SlackBuild script must exist, with mode 0755 (or 0644, if in a git repo),
and be a I<#!/bin/sh> script.
@@ -612,11 +617,13 @@ sub check_and_read {
my $crlf_err;
my @lines;
+ my $lastline_nonl;
check_mode($file, $mode);
if(open my $fh, "<$file") {
while(<$fh>) {
+ $lastline_nonl = 1 unless /\n$/;
chomp;
$crlf_err = 1 if s/\r$//;
push @lines, $_;
@@ -627,11 +634,16 @@ sub check_and_read {
}
log_error("$file has DOS-style CRLF line endings") if $crlf_err;
+ log_error("$file has no newline at EOF") if $lastline_nonl;
return @lines;
}
sub check_readme {
- check_and_read("README", 0644);
+ my @lines = check_and_read("README", 0644);
+ if(grep { length > 72 } @lines) {
+ log_warning("README has lines >72 characters");
+ }
+ # TODO: check encoding (must be ASCII or UTF-8)
}
# the slack-desc checking code offends me (the author), on the one hand it's