On 3/29/07, via RT Will Coleda <[EMAIL PROTECTED]> wrote:
# New Ticket Created by  Will Coleda
# Please include the string:  [perl #42170]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42170 >


For steve_p on #parrot.

I find this a little too verbose, but would not object if someone
applied it.

=== t/codingstd/trailing_space.t
==================================================================
--- t/codingstd/trailing_space.t        (revision 4828)
+++ t/codingstd/trailing_space.t        (local)
@@ -50,14 +50,13 @@
      # slurp in the file
      open( my $fh, '<', $path )
          or die "Cannot open '$path' for reading: $!\n";
+
+    while (my $line=<$fh>)
      {
-        local $/;
-        $buf = <$fh>;
+        if ( $line =~ m{.?[ \t]+$} ) {
+            push @failed_files, "$path:$.";
+        }
      }
-
-    if ( $buf =~ m{.?[ \t]+$}m ) {
-        push @failed_files, $path;
-    }
}
# check the file

do you really need a line number in test output? in vim:
  / $

will find you every line with trailing spaces.
better yet, do like i do, and set this in your .vimrc:
 set list
 set listchars=trail:-,tab:\.\

NOTE: there is a trailing space on the line above. it's IMPORTANT.
not only will this show you trailing spaces (as dashes), but leading
tabs (as dot followed by space). that way you'll notice and fix them
before you commit. i've never run emacs, so i don't know the lispy
analog. i'm sure somebody will chime in with it.
~jerry

Reply via email to