[bugzilla-gnome-org-extensions] trace parser: Fix whitespace issues



commit 712ca9d7bd40022547a9874a0edb4d5e865cd386
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Wed Nov 12 23:59:10 2014 +0100

    trace parser: Fix whitespace issues

 TraceParser/Extension.pm                           |   42 +++++++++----------
 TraceParser/lib/Trace.pm                           |   15 +++----
 TraceParser/rehash-traces.pl                       |    8 ++--
 .../hook/global/header-additional_header.html.tmpl |    2 +-
 .../hook/global/user-error-errors.html.tmpl        |    2 +-
 .../pages/traceparser/popular-traces.html.tmpl     |    2 +-
 .../en/default/pages/traceparser/trace.html.tmpl   |    6 +-
 .../en/default/traceparser/format.html.tmpl        |   10 ++--
 .../traceparser/possible-duplicate.html.tmpl       |    8 ++--
 9 files changed, 46 insertions(+), 49 deletions(-)
---
diff --git a/TraceParser/Extension.pm b/TraceParser/Extension.pm
index 692ecd4..5b36c78 100644
--- a/TraceParser/Extension.pm
+++ b/TraceParser/Extension.pm
@@ -41,7 +41,7 @@ use constant DEFAULT_POPULAR_LIMIT => 20;
 
 sub bug_end_of_create {
     my ($self, $args) = @_;
-    
+
     my $bug = $args->{bug};
     my $comments = $bug->comments({ order => 'oldest_to_newest' });
     my $comment = $comments->[0];
@@ -49,7 +49,7 @@ sub bug_end_of_create {
     return if !$data;
     my $trace = Bugzilla::Extension::TraceParser::Trace->create(
         { %$data, comment_id => $comment->id });
-    _check_duplicate_trace($trace, $bug, $comment);    
+    _check_duplicate_trace($trace, $bug, $comment);
 }
 
 sub _check_duplicate_trace {
@@ -72,9 +72,9 @@ sub _check_duplicate_trace {
     if (@identical or @similar) {
         $dbh->bz_rollback_transaction if $dbh->bz_in_transaction;
         my $product = $bug->product;
-        my @prod_traces  = grep { $_->bug->product eq $product } 
+        my @prod_traces  = grep { $_->bug->product eq $product }
                                 (@identical, @similar);
-        my @other_traces = grep { $_->bug->product ne $product } 
+        my @other_traces = grep { $_->bug->product ne $product }
                                 (@identical, @similar);
 
         my %vars = (
@@ -224,13 +224,13 @@ sub _handle_dup_to {
 
     # This is what we do for all non-browser usage modes.
     ThrowUserError('traceparser_dup_to',
-                   { dup_to => $dup_to, 
+                   { dup_to => $dup_to,
                      comment_added => $comment_added });
 }
 
 sub bug_end_of_update {
     my ($self, $args) = @_;
-    
+
     my ($bug, $timestamp) = @$args{qw(bug timestamp)};
     return if !$bug->{added_comments};
     # Delete the cache, because we want to refresh this from the DB.
@@ -244,7 +244,7 @@ sub bug_end_of_update {
         next if !$data;
         Bugzilla::Extension::TraceParser::Trace->create(
             { %$data, comment_id => $comment->id });
-    }    
+    }
 }
 
 sub bug_format_comment {
@@ -282,15 +282,13 @@ sub bug_format_comment {
 
 sub db_schema_abstract_schema {
     my ($self, $args) = @_;
-    
-    
-    
+
     my $schema = $args->{schema};
     $schema->{trace} = {
         FIELDS => [
-            id          => {TYPE => 'MEDIUMSERIAL',  NOTNULL => 1, 
+            id          => {TYPE => 'MEDIUMSERIAL',  NOTNULL => 1,
                             PRIMARYKEY => 1},
-            comment_id  => {TYPE => 'INT3', NOTNULL => 1, 
+            comment_id  => {TYPE => 'INT3', NOTNULL => 1,
                             REFERENCES => {TABLE  => 'longdescs',
                                            COLUMN => 'comment_id',
                                            DELETE => 'CASCADE'}},
@@ -306,17 +304,17 @@ sub db_schema_abstract_schema {
             trace_comment_id_idx => {TYPE => 'UNIQUE', FIELDS => ['comment_id']},
         ],
     };
-    
+
     $schema->{trace_dup} = {
         FIELDS => [
             hash      => {TYPE => 'char(22)', NOTNULL => 1},
             identical => {TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 0},
-            bug_id    => {TYPE => 'INT3', NOTNULL => 1, 
+            bug_id    => {TYPE => 'INT3', NOTNULL => 1,
                           REFERENCES => {TABLE  => 'bugs',
                                          COLUMN => 'bug_id'}},
         ],
         INDEXES => [
-            trace_dup_hash_idx => {TYPE => 'UNIQUE', 
+            trace_dup_hash_idx => {TYPE => 'UNIQUE',
                                    FIELDS => [qw(hash identical)]},
             trace_bug_id_idx   => ['bug_id'],
         ],
@@ -325,14 +323,14 @@ sub db_schema_abstract_schema {
 
 sub install_before_final_checks {
     my ($self, $args) = @_;
-    
+
     if (!new Bugzilla::Group({ name => 'traceparser_edit' })) {
         Bugzilla::Group->create({
             name        => 'traceparser_edit',
             description => 'Can edit properties of traces',
             isbuggroup  => 0 });
     }
-    
+
     add_setting('traceparser_show_traces',
                 ['on', 'off'], 'off');
 }
@@ -350,7 +348,7 @@ sub install_update_db {
         $dbh->{'mysql_use_result'} = 1;
     }
 
-    my $sth = $dbh->prepare('SELECT comment_id, thetext FROM longdescs 
+    my $sth = $dbh->prepare('SELECT comment_id, thetext FROM longdescs
                            ORDER BY comment_id');
     $sth->execute();
     my $count = 1;
@@ -384,7 +382,7 @@ sub install_update_db {
 
 sub page_before_template {
     my ($self, $args) = @_;
-    
+
     my ($vars, $page) = @$args{qw(vars page_id)};
     if ($page =~ m{^traceparser/trace\.}) {
         _page_trace($vars);
@@ -410,7 +408,7 @@ sub _page_trace {
     my $action = $cgi->param('action') || '';
     if ($action eq 'update') {
         $user->in_group('traceparser_edit')
-          or ThrowUserError('auth_failure', 
+          or ThrowUserError('auth_failure',
                  { action => 'modify', group => 'traceparser_edit',
                    object => 'settings' });
         if (!$trace->stack_hash) {
@@ -469,9 +467,9 @@ sub _page_popular_traces {
           WHERE short_hash IS NOT NULL $extra_where
        GROUP BY short_hash ORDER BY trace_count DESC "
         . $dbh->sql_limit('?'), {Columns=>[1,2]}, $limit) };
- 
+
     my $traces = Bugzilla::Extension::TraceParser::Trace->new_from_list([keys %trace_count]);
-    @$traces = reverse sort { $trace_count{$a->id} <=> $trace_count{$b->id} } 
+    @$traces = reverse sort { $trace_count{$a->id} <=> $trace_count{$b->id} }
                             @$traces;
     $vars->{limit} = $limit;
     $vars->{traces} = $traces;
diff --git a/TraceParser/lib/Trace.pm b/TraceParser/lib/Trace.pm
index 2a6a8c1..9d2e365 100644
--- a/TraceParser/lib/Trace.pm
+++ b/TraceParser/lib/Trace.pm
@@ -16,7 +16,7 @@
 # Portions created by the Initial Developer are Copyright (C) 2009
 # the Initial Developer. All Rights Reserved.
 #
-# Contributor(s): 
+# Contributor(s):
 #   Max Kanat-Alexander <mkanat bugzilla org>
 
 package Bugzilla::Extension::TraceParser::Trace;
@@ -106,22 +106,22 @@ sub _do_list_select {
         my $dbh = Bugzilla->dbh;
         my @trace_ids = map { $_->id } @$objects;
         my $comment_info = $dbh->selectall_arrayref(
-            'SELECT trace.id AS id, longdescs.bug_id AS bug_id, 
+            'SELECT trace.id AS id, longdescs.bug_id AS bug_id,
                     longdescs.isprivate AS isprivate
-               FROM trace INNER JOIN longdescs 
+               FROM trace INNER JOIN longdescs
                           ON trace.comment_id = longdescs.comment_id
               WHERE trace.id IN(' . join(',', @trace_ids) . ')', {Slice=>{}});
 
         my %bug_ids = map { $_->{id} => $_->{bug_id} } @$comment_info;
         my %private = map { $_->{id} => $_->{isprivate} } @$comment_info;
-        
+
         my %unique_ids = map { $bug_ids{$_} => 1 } (keys %bug_ids);
         my $bugs = Bugzilla::Bug->new_from_list([values %bug_ids]);
 
         # Populate "product" & dup_id for each bug.
         my %product_ids = map { $_->{product_id} => 1 } @$bugs;
         my %products = @{ $dbh->selectcol_arrayref(
-            'SELECT id, name FROM products WHERE id IN(' 
+            'SELECT id, name FROM products WHERE id IN('
             . join(',', keys %product_ids) . ')', {Columns=>[1,2]}) };
         my %dup_ids = @{ $dbh->selectcol_arrayref(
             'SELECT dupe, dupe_of FROM duplicates WHERE dupe IN ('
@@ -372,7 +372,6 @@ sub _relevant_functions {
             $file =~ s/.py$//i;
             $function = ".$function" if $function;
             $function = "$file$function";
-            
         }
         if (!grep($_ eq $function, IGNORE_FUNCTIONS)) {
             $function =~ s/^IA__//;
@@ -464,8 +463,8 @@ sub _update_dup {
         'SELECT 1 FROM trace_dup WHERE hash = ? AND identical = ?',
         undef, $hash, $identical);
     if ($exists) {
-        $dbh->do('UPDATE trace_dup SET bug_id = ? 
-                   WHERE hash = ? AND identical = ?', 
+        $dbh->do('UPDATE trace_dup SET bug_id = ?
+                   WHERE hash = ? AND identical = ?',
                  undef, $bug_id, $hash, $identical);
     }
     else {
diff --git a/TraceParser/rehash-traces.pl b/TraceParser/rehash-traces.pl
index c20b558..e278723 100644
--- a/TraceParser/rehash-traces.pl
+++ b/TraceParser/rehash-traces.pl
@@ -12,11 +12,11 @@ my $dbh = Bugzilla->dbh;
 
 print "Re-parsing traces...\n";
 my $total = $dbh->selectrow_array('SELECT COUNT(*) FROM trace');
-    
+
 if ($dbh->isa('Bugzilla::DB::Mysql')) {
     $dbh->{'mysql_use_result'} = 1;
 }
-    
+
 my $sth = $dbh->prepare('SELECT id,trace_text FROM trace ORDER BY id');
 $sth->execute();
 my $count = 0;
@@ -37,9 +37,9 @@ $dbh->bz_start_transaction();
 print "Updating trace hashes...\n";
 $count = 1;
 foreach my $trace (@traces) {
-    $dbh->do("UPDATE trace SET stack_hash = ?, short_hash = ?, quality = ? 
+    $dbh->do("UPDATE trace SET stack_hash = ?, short_hash = ?, quality = ?
                WHERE id = ?",
-             undef, $trace->{stack_hash}, $trace->{short_hash}, 
+             undef, $trace->{stack_hash}, $trace->{short_hash},
              $trace->{quality}, $trace->{id});
     indicate_progress({ current => $count, total => $total, every => 10 });
 }
diff --git a/TraceParser/template/en/default/hook/global/header-additional_header.html.tmpl 
b/TraceParser/template/en/default/hook/global/header-additional_header.html.tmpl
index 5218daf..291434d 100644
--- a/TraceParser/template/en/default/hook/global/header-additional_header.html.tmpl
+++ b/TraceParser/template/en/default/hook/global/header-additional_header.html.tmpl
@@ -19,5 +19,5 @@
   #   Max Kanat-Alexander <mkanat bugzilla org>
   #%]
 
-<link rel="stylesheet" type="text/css" 
+<link rel="stylesheet" type="text/css"
       href="extensions/TraceParser/web/style.css">
diff --git a/TraceParser/template/en/default/hook/global/user-error-errors.html.tmpl 
b/TraceParser/template/en/default/hook/global/user-error-errors.html.tmpl
index 547a21a..41e9a91 100644
--- a/TraceParser/template/en/default/hook/global/user-error-errors.html.tmpl
+++ b/TraceParser/template/en/default/hook/global/user-error-errors.html.tmpl
@@ -15,7 +15,7 @@
 
 [% ELSIF error == "traceparser_dup_to_closed" %]
     [% title = "Stack Trace Is a Duplicate" %]
-    The crash you submitted appears to be a duplicate of 
+    The crash you submitted appears to be a duplicate of
     [%+ "$terms.bug $dup_to.id" FILTER bug_link(dup_to) %].
 
     [% IF dup_to.resolution == 'FIXED' %]
diff --git a/TraceParser/template/en/default/pages/traceparser/popular-traces.html.tmpl 
b/TraceParser/template/en/default/pages/traceparser/popular-traces.html.tmpl
index 41a6e35..c725b22 100644
--- a/TraceParser/template/en/default/pages/traceparser/popular-traces.html.tmpl
+++ b/TraceParser/template/en/default/pages/traceparser/popular-traces.html.tmpl
@@ -26,7 +26,7 @@
 <form action="page.cgi" method="GET">
 <div>
   <input type="hidden" name="id" value="traceparser/popular-traces.html">
-  Show the top 
+  Show the top
   <input type="text" size="3" name="limit" value="[% limit FILTER html %]">
   traces.
   <input type="submit" value="Go">
diff --git a/TraceParser/template/en/default/pages/traceparser/trace.html.tmpl 
b/TraceParser/template/en/default/pages/traceparser/trace.html.tmpl
index 6723e1b..392764d 100644
--- a/TraceParser/template/en/default/pages/traceparser/trace.html.tmpl
+++ b/TraceParser/template/en/default/pages/traceparser/trace.html.tmpl
@@ -20,7 +20,7 @@
   #%]
 
 [% PROCESS global/header.html.tmpl
-   title = "Trace $trace.id From Bug $trace.bug.id" 
+   title = "Trace $trace.id From Bug $trace.bug.id"
 %]
 
 [% IF user.in_group('traceparser_edit') %]
@@ -56,8 +56,8 @@
   [% PROCESS trace_list list = similar_traces %]
 [% END %]
 
-<h2>Trace [% trace.id FILTER html %] 
-  (Quality: [% trace.quality FILTER html %]) on 
+<h2>Trace [% trace.id FILTER html %]
+  (Quality: [% trace.quality FILTER html %]) on
   [%+ "$terms.Bug $trace.bug.id" FILTER bug_link(trace.bug) %]</h2>
 
 <table border="0" cellpadding="0" cellspacing="0"><tr><td><div class="trace">
diff --git a/TraceParser/template/en/default/traceparser/format.html.tmpl 
b/TraceParser/template/en/default/traceparser/format.html.tmpl
index edb1852..b0d89b5 100644
--- a/TraceParser/template/en/default/traceparser/format.html.tmpl
+++ b/TraceParser/template/en/default/traceparser/format.html.tmpl
@@ -31,7 +31,7 @@
     [%+ trace.id FILTER html %]</a></p>
 
 <table border="0" cellpadding="0" cellspacing="0"><tr><td>
-<div class="trace [% ' bz_default_hidden' IF !show %]" 
+<div class="trace [% ' bz_default_hidden' IF !show %]"
      id="trace_[% trace.id FILTER html %]">
   [% IF trace.type.match('Python') %]
     <ul class="frames">
@@ -60,10 +60,10 @@
     [% ELSE %]
       [% threads = trace.stack.threads %]
     [% END %]
-    
+
     [% FOREACH thread = threads %]
       [% IF thread.number || thread.description %]
-        <p class="thread_description">Thread [% thread.number FILTER html %] 
+        <p class="thread_description">Thread [% thread.number FILTER html %]
           ([% thread.description FILTER html %])</p>
       [% END %]
 
@@ -76,7 +76,7 @@
             <span class="frame_function">[% frame.function FILTER html %]</span>
             [% IF frame.library %]
               <div class="frame_library_container">
-                from 
+                from
                 <span class="frame_library">[% frame.library FILTER html %]</span>
               </div>
             [% END %]
@@ -84,7 +84,7 @@
               <div class="frame_file_container">
                 at <span class="frame_file">[% frame.file FILTER html %]</span>
                 [% IF frame.line %]
-                  line 
+                  line
                   <span class="frame_line">[% frame.line FILTER html %]</span>
                 [% END %]
               </div>
diff --git a/TraceParser/template/en/default/traceparser/possible-duplicate.html.tmpl 
b/TraceParser/template/en/default/traceparser/possible-duplicate.html.tmpl
index b90189e..a9cc1fa 100644
--- a/TraceParser/template/en/default/traceparser/possible-duplicate.html.tmpl
+++ b/TraceParser/template/en/default/traceparser/possible-duplicate.html.tmpl
@@ -37,10 +37,10 @@
 
 <h2>Similar [% terms.Bugs %]</h2>
 
-<form id="submit_dup" method="POST" 
+<form id="submit_dup" method="POST"
       action="page.cgi?id=traceparser/post-duplicate-trace.none">
   <input type="hidden" name="comment" value="[% comment.body FILTER html %]">
-  <input type="hidden" name="isprivate" 
+  <input type="hidden" name="isprivate"
          value="[% comment.is_private FILTER html %]">
   [% SET shown_bugs = 0 %]
   [% IF prod_bugs.size %]
@@ -82,8 +82,8 @@
   <input type="hidden" name="traceparser_skip_duplicate" value="1">
 
   <p>If none of the above [% terms.bugs %] look like the bug
-    you are trying to file, then 
-    <input type="submit" id="file_bug_again" 
+    you are trying to file, then
+    <input type="submit" id="file_bug_again"
            value="Continue to File This [% terms.Bug %]"></p>
   [% PROCESS "global/hidden-fields.html.tmpl"
              exclude="^(Bugzilla_login|Bugzilla_password|ignore_token)$" %]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]