[libcode-tidyall-perl] 94/374: send back individual error messages; fix find_root_for_file inf loop

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:25:55 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libcode-tidyall-perl.

commit a132ada0696760ff2ae52eb262a015bb1bbe5816
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Mon Jul 16 16:28:05 2012 -0700

    send back individual error messages; fix find_root_for_file inf loop
---
 lib/Code/TidyAll/SVN/Precommit.pm |   19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/lib/Code/TidyAll/SVN/Precommit.pm b/lib/Code/TidyAll/SVN/Precommit.pm
index a1b05a5..8e09365 100644
--- a/lib/Code/TidyAll/SVN/Precommit.pm
+++ b/lib/Code/TidyAll/SVN/Precommit.pm
@@ -1,7 +1,7 @@
 package Code::TidyAll::SVN::Precommit;
 use Capture::Tiny qw(capture_stdout capture_stderr);
 use Code::TidyAll;
-use Code::TidyAll::Util qw(dirname mkpath tempdir_simple write_file);
+use Code::TidyAll::Util qw(dirname mkpath realpath tempdir_simple write_file);
 use Log::Any qw($log);
 use Moo;
 use SVN::Look;
@@ -82,12 +82,17 @@ sub _check {
         }
     }
 
-    if ( my $error_count = grep { $_->error } @results ) {
-        die sprintf( "%d file%s did not pass tidyall check\n",
-            $error_count, $error_count > 1 ? "s" : "" );
+    if ( my @error_results = grep { $_->error } @results ) {
+        my $error_count = scalar(@error_results);
+        die join(
+            "\n",
+            sprintf(
+                "%d file%s did not pass tidyall check",
+                $error_count, $error_count > 1 ? "s" : ""
+            ),
+            map { $_->msg } @error_results
+        );
     }
-
-    die "ok!";
 }
 
 sub find_root_for_file {
@@ -101,7 +106,7 @@ sub find_root_for_file {
         if ( $self->cat_file("$search_dir/$conf_file") ) {
             return $search_dir;
         }
-        elsif ( $search_dir eq '/' || $search_dir eq '' ) {
+        elsif ( $search_dir eq '/' || $search_dir eq '' || $search_dir eq '.' ) {
             return undef;
         }
         else {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git



More information about the Pkg-perl-cvs-commits mailing list