diff options
author | B. Watson <urchlay@slackware.uk> | 2022-07-07 16:25:34 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2022-07-07 16:25:34 -0400 |
commit | 3e7fe579412897e312c64a6e757d74148438a924 (patch) | |
tree | 4e5a22941e59b154bcb08517874e9c5cd0092df5 | |
parent | 586ad2ce86475daeed7a09d00dc3e042dc9dde8b (diff) | |
download | sbo-maintainer-tools-3e7fe579412897e312c64a6e757d74148438a924.tar.gz |
sbolint: add note to try sbofixinfo in check_info()
-rwxr-xr-x | sbofixinfo | 18 | ||||
-rwxr-xr-x | sbolint | 17 |
2 files changed, 25 insertions, 10 deletions
@@ -91,12 +91,13 @@ comprehensive checking. The file is modified 'in-place', in the same way as the B<-i> option to B<sed>(1). -B<sbofixinfo> keeps a backup of the original file with the -extension I<.bak> appended to the filename. If the backup file already -exists, it will be silently overwritten. After the new file is generated, -B<diff>(1) (with its B<-u> and B<--color> options) is run on the backup and modified -files, and the backup is deleted if the new file is identical. The diff -output also goes to stdout, so the user can see what changes were made. +B<sbofixinfo> keeps a backup of the original file with the extension +I<.bak> appended to the filename. If the backup file already exists, +it will be silently overwritten. After the new file is generated, +B<diff>(1) (with its B<-u> and B<--color> options) is run on the +backup and modified files, and the backup is deleted if the new file +is identical. The diff output also goes to stdout, so the user can see +what changes were made. =head1 EXIT STATUS @@ -105,10 +106,6 @@ files occur, the exit status will be the error count. =head1 BUGS -Misspelled key names (e.g. MD5USM or DOWNLAOD) will be discarded. Not -a true bug (it's by design), but it violates the principle of least -surprise a bit. - B<sbofixinfo> can't automatically fix every issue B<sbolint> reports. In particular, missing or extra values (for valid keys) can't automatically be fixed. This isn't really a bug, as B<sbofixinfo> @@ -154,6 +151,7 @@ for($arg0) { exec("pod2man --stderr -s1 -csbo-maintainer-tools -r$VERSION $0") || die "$SELF: can't exec pod2man\n"; }; + # undocumented option: /^--keytest/ && do { while(<STDIN>) { chomp; @@ -844,6 +844,8 @@ sub check_info { my @keys; my $continuation = 0; + my $fixable = 0; + # parse and bitch about bad syntax... for(@lines) { $file_lineno++; @@ -863,20 +865,24 @@ sub check_info { if(/^\s*$/) { log_error("$file:$lineno: blank line (get rid of it)"); + $fixable++; next; } unless(/=/) { log_error("$file:$lineno: malformed line (no = sign, missing \\ on prev line?)"); + $fixable++; next; } if(s/^\s+//) { log_error("$file:$lineno: leading whitespace before key"); + $fixable++; } if(s/\s+$//) { log_error("$file:$lineno: trailing whitespace at EOL"); + $fixable++; } if(my ($k, $s1, $s2, $q1, $val, $q2) = /^(\w+)(\s*)=(\s*)("?)(.*?)("?)$/) { @@ -885,37 +891,48 @@ sub check_info { } else { if($k ne $expected[$next_exp]) { log_warning("$file:$lineno: out of order, expected $expected[$next_exp], got $k"); + $fixable++; } $next_exp++; } if(not $q1) { log_error("$file:$lineno: missing opening double-quote"); + $fixable++; } if(not $q2) { log_error("$file:$lineno: missing closing double-quote"); + $fixable++; } if(length($s1) || length($s2)) { log_error("$file:$lineno: no spaces allowed before/after = sign"); + $fixable++; } my $oldval = $val; if($val =~ s/^\s+//) { log_error("$file:$lineno: leading space in value: \"$oldval\""); + $fixable++; } if($val =~ s/\s+$//) { log_error("$file:$lineno: trailing space in value: \"$oldval\""); + $fixable++; } $info{$k} = $val; } else { log_error("$file:$lineno: malformed line"); + $fixable++; } } + if($fixable) { + logmsg("NOTE", $fixable . " possibly-fixable errors found. suggest running sbofixinfo."); + } + # parsing done, now for semantic checks my @missing; |