]> git.donarmstrong.com Git - perltidy.git/commitdiff
add util to check line length
authorSteve Hancock <perltidy@users.sourceforge.net>
Sat, 7 Dec 2024 17:44:46 +0000 (09:44 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sat, 7 Dec 2024 17:44:46 +0000 (09:44 -0800)
dev-bin/check_perltidy_line_length.pl [new file with mode: 0755]

diff --git a/dev-bin/check_perltidy_line_length.pl b/dev-bin/check_perltidy_line_length.pl
new file mode 100755 (executable)
index 0000000..8d35334
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/perl -w
+use strict;
+
+# check that the lines with fixed lengths in the perltidy pod are not too long
+my $fname='perltidy';
+my $fh;
+if (!open($fh, '<', $fname)) {
+   print "cannot open $fname: $!\n";
+}
+my @too_long;
+my $lno=0;
+while (my $line=<$fh>) {
+   $lno++;
+   my $excess=length($line)-80;
+   next if ($excess<=0);
+   next if ($line !~ /^\s/);
+   print "$lno:$excess:$line";
+   push @too_long, $lno;
+}
+if (@too_long) {
+   my $num=@too_long;
+   print "$num lines exceed 80 chars:\n";
+}