From eab14134c1a95b4bc5b58cbe534e6171811b1329 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 25 Nov 2020 21:49:13 -0500 Subject: sbolint: enforce 72-char limit in README --- sbolint | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sbolint') 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 -- cgit v1.2.3