spamassassin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmcgr...@apache.org
Subject svn commit: r1428702 - in /spamassassin/trunk: lib/Mail/SpamAssassin/Conf/Parser.pm lib/Mail/SpamAssassin/PerMsgStatus.pm t/duplicates.t
Date Fri, 04 Jan 2013 02:44:04 GMT
Author: kmcgrail
Date: Fri Jan  4 02:44:03 2013
New Revision: 1428702

URL: http://svn.apache.org/viewvc?rev=1428702&view=rev
Log:
update to change rule descriptions that are blank to "No description available." and code
to list rules missing descriptions with -D - bug 6880

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
    spamassassin/trunk/t/duplicates.t

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm?rev=1428702&r1=1428701&r2=1428702&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm Fri Jan  4 02:44:03 2013
@@ -495,6 +495,7 @@ failed_line:
 
   $self->lint_check();
   $self->set_default_scores();
+  $self->check_for_missing_descriptions();
 
   delete $self->{scoresonly};
 }
@@ -640,6 +641,21 @@ sub set_default_scores {
   }
 }
 
+# loop through all the tests and if we are missing a description with debug
+# set, throw a warning except for testing T_ or meta __ rules.
+sub check_for_missing_descriptions {
+  my ($self) = @_;
+  my $conf = $self->{conf};
+
+  while ( my $k = each %{$conf->{tests}} ) {
+    if ($k !~ m/^(?:T_|__)/i) {
+      if ( ! exists $conf->{descriptions}->{$k} ) {
+        dbg("config: warning: no description set for $k");
+      }
+    }
+  }
+}
+
 ###########################################################################
 
 sub setup_default_code_cb {

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1428702&r1=1428701&r2=1428702&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri Jan  4 02:44:03 2013
@@ -2469,7 +2469,10 @@ sub got_hit {
   } else {
     $rule_descr = $conf_ref->get_description_for_rule($rule);  # static
   }
-  $rule_descr = $rule  if !defined $rule_descr || $rule_descr eq '';
+  # Bug 6880 Set Rule Description to something that says no rule
+  #$rule_descr = $rule  if !defined $rule_descr || $rule_descr eq '';
+  $rule_descr = "No description available." if !defined $rule_descr || $rule_descr eq '';
+
   $self->_handle_hit($rule,
             $score,
             $area,

Modified: spamassassin/trunk/t/duplicates.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/duplicates.t?rev=1428702&r1=1428701&r2=1428702&view=diff
==============================================================================
--- spamassassin/trunk/t/duplicates.t (original)
+++ spamassassin/trunk/t/duplicates.t Fri Jan  4 02:44:03 2013
@@ -44,25 +44,36 @@ tstprefs (qq{
    loadplugin Mail::SpamAssassin::Plugin::Test
 
    body FOO1 /click here and e= nter your/i
+   describe FOO1 Test rule
    body FOO2 /click here and e= nter your/i
+   describe FOO2 Test rule
 
    # should not be found, not a dup (/i)
    body FOO3 /click here and e= nter your/
+   describe FOO3 Test rule
 
    # should not be found, not dup since different type
    rawbody RAWFOO /click here and e= nter your/i
+   describe RAWFOO Test rule
 
    header HDR1 Subject =~ /stained/
+   describe HDR1 Test rule
    header HDR2 Subject =~ /stained/
+   describe HDR2 Test rule
 
    # should not be merged -- eval rules (bug 5959)
-   header HDREVAL1 eval:check_test_plugin()
+   header HDREVAL1 eval:check_test_plugin() 
+   describe HDREVAL1 Test rule
    header HDREVAL2 eval:check_test_plugin()
+   describe HDREVAL2 Test rule
 
    meta META1 (1)
+   describe META1 Test rule
    meta META2 (META1 && META3)
+   describe META2 Test rule
    meta META3 (1)
    priority META3 -500
+   describe META3 Test rule
 
 });
 



Mime
View raw message