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

Bug#644556: [checks/source-copyright] improve wording for source-copyright-dep5-syntax-error



Package: lintian
Version: 2.5.3
Severity: wishlist
Tags: patch

The attached patch makes syntax-error-in-dep5-copyright a bit more readable: - It removes "syntax error in " prefix, since the tag name already implies that this is a syntax error.
- It removes trailing newline from message.
- It adjusts wording to use the same terms as DEP-5 and Policy: "paragraph" and "field", rather than "section" and "tag".

--
Jakub Wilk
diff --git a/checks/source-copyright b/checks/source-copyright
--- a/checks/source-copyright
+++ b/checks/source-copyright
@@ -132,7 +132,9 @@
                     @dep5 = read_dpkg_control($copyright_filename);
                 };
                 if ($@) {
+                    chomp $@;
                     $@ =~ s/^internal error: //;
+                    $@ =~ s/^syntax error in //;
                     tag 'syntax-error-in-dep5-copyright', $@;
                 }
             }
diff --git a/lib/Util.pm b/lib/Util.pm
--- a/lib/Util.pm
+++ b/lib/Util.pm
@@ -138,7 +138,7 @@
         }
         # continued field?
         elsif (m/^([ \t].*)$/o) {
-            $open_section or fail("syntax error in section $cur_section after the tag $last_tag: $_");
+            $open_section or fail("syntax error in paragraph $cur_section after the field $last_tag: $_");
 
             # Policy: Many fields' values may span several lines; in this case
             # each continuation line must start with a space or a tab.  Any
@@ -150,8 +150,8 @@
         }
         # None of the above => syntax error
         else {
-            my $message = "syntax error in section $cur_section";
-            $message.= " after the tag $last_tag: $_" if defined $last_tag;
+            my $message = "syntax error in paragraph $cur_section";
+            $message.= " after the field $last_tag: $_" if defined $last_tag;
             fail($message);
         }
     }
diff --git a/t/tests/source-copyright-dep5-syntax-error/tags b/t/tests/source-copyright-dep5-syntax-error/tags
--- a/t/tests/source-copyright-dep5-syntax-error/tags
+++ b/t/tests/source-copyright-dep5-syntax-error/tags
@@ -1,1 +1,1 @@
-W: source-copyright-dep5-syntax-error source: syntax-error-in-dep5-copyright syntax error in section 2 after the tag license:  This package is distributed in the hope that it will be useful, but WITHOUT\n
+W: source-copyright-dep5-syntax-error source: syntax-error-in-dep5-copyright paragraph 2 after the field license:  This package is distributed in the hope that it will be useful, but WITHOUT

Reply to: