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

[lintian] 01/01: checks/upstream-metadata: Include YAML validation error in the output



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

jwilk pushed a commit to branch master
in repository lintian.

commit 109cf8c9efebcbbc6a1a18896f71cb2aee992647
Author: Jakub Wilk <jwilk@debian.org>
Date:   Wed May 18 16:07:23 2016 +0200

    checks/upstream-metadata: Include YAML validation error in the output
---
 checks/upstream-metadata.pm                | 9 ++++++++-
 debian/changelog                           | 2 ++
 t/tests/upstream-metadata-invalid-yml/tags | 2 +-
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/checks/upstream-metadata.pm b/checks/upstream-metadata.pm
index 62e5182..08798db 100644
--- a/checks/upstream-metadata.pm
+++ b/checks/upstream-metadata.pm
@@ -36,7 +36,14 @@ sub run {
         my $yaml;
         eval { $yaml = YAML::XS::LoadFile($yamlfile->fs_path); };
         if (!$yaml) {
-            tag('upstream-metadata-yaml-invalid');
+            my $msg;
+            if (my ($reason, $doc, $line, $col)
+                = $@
+                =~ m/\AYAML::XS::Load Error: The problem:\n\n ++(.+)\n\nwas found at document: (\d+), line: (\d+), column: (\d+)\n/
+              ) {
+                $msg = "$reason (at document $doc, line $line, column $col)";
+            }
+            tag('upstream-metadata-yaml-invalid', $msg);
         }
     } else {
         tag('upstream-metadata-is-not-a-file');
diff --git a/debian/changelog b/debian/changelog
index 8f69aa4..468e06a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -36,6 +36,8 @@ lintian (2.5.45) UNRELEASED; urgency=medium
   * checks/testsuite.pm:
     + [NT] Apply patch from Ondřej Nový to add more known
       autodep8 test suites.  (Closes: #823088)
+  * checks/upstream-metadata.pm:
+    + [JW] Include YAML validation error in the output.
 
   * collection/*:
     + [NT] Always pass "-n" to "gzip".
diff --git a/t/tests/upstream-metadata-invalid-yml/tags b/t/tests/upstream-metadata-invalid-yml/tags
index 37841c1..ecb4fe0 100644
--- a/t/tests/upstream-metadata-invalid-yml/tags
+++ b/t/tests/upstream-metadata-invalid-yml/tags
@@ -1 +1 @@
-W: upstream-metadata-invalid-yml source: upstream-metadata-yaml-invalid
+W: upstream-metadata-invalid-yml source: upstream-metadata-yaml-invalid did not find expected <document start> (at document 2, line 2, column 1)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: