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

Bug#831864: lintian: Should warn about python packages which ship coverage information



tags 831864 + patch
thanks

Hi Lintian maintainers,

Attached is the following:

  commit 707a5c5965f4349735e185caaf18f7af022d279f
  Author: Chris Lamb <lamby@debian.org>
  Date:   Wed Aug 24 19:12:16 2016 +0100
  
      c/files: Warn about Python packages which ship coverage.py information. (Closes: #831864)
      
      Signed-off-by: Chris Lamb <lamby@debian.org>
  
   checks/files.desc                                   | 12 ++++++++++++
   checks/files.pm                                     |  5 +++++
   t/tests/files-python-coverage/debian/.coverage      |  0
   t/tests/files-python-coverage/debian/debian/install |  1 +
   t/tests/files-python-coverage/debian/debian/rules   |  4 ++++
   t/tests/files-python-coverage/desc                  |  6 ++++++
   t/tests/files-python-coverage/tags                  |  1 +
   7 files changed, 29 insertions(+)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-
From 707a5c5965f4349735e185caaf18f7af022d279f Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Wed, 24 Aug 2016 19:12:16 +0100
Subject: [PATCH] c/files: Warn about Python packages which ship coverage.py
 information. (Closes: #831864)

Signed-off-by: Chris Lamb <lamby@debian.org>
---
 checks/files.desc                                   | 12 ++++++++++++
 checks/files.pm                                     |  5 +++++
 t/tests/files-python-coverage/debian/.coverage      |  0
 t/tests/files-python-coverage/debian/debian/install |  1 +
 t/tests/files-python-coverage/debian/debian/rules   |  4 ++++
 t/tests/files-python-coverage/desc                  |  6 ++++++
 t/tests/files-python-coverage/tags                  |  1 +
 7 files changed, 29 insertions(+)
 create mode 100644 t/tests/files-python-coverage/debian/.coverage
 create mode 100644 t/tests/files-python-coverage/debian/debian/install
 create mode 100755 t/tests/files-python-coverage/debian/debian/rules
 create mode 100644 t/tests/files-python-coverage/desc
 create mode 100644 t/tests/files-python-coverage/tags

diff --git a/checks/files.desc b/checks/files.desc
index 5ddc26b..34baa92 100644
--- a/checks/files.desc
+++ b/checks/files.desc
@@ -846,6 +846,18 @@ Info: Python eggs should not be installed, since the Debian package is
  .
  The egg may contain pre-compiled Python bytecode or shared libraries.
 
+Tag: package-contains-python-coverage-file
+Severity: normal
+Certainty: certain
+Info: The package conains a file that looks like output from the Python
+ coverage.py tool.  These are generated by python{,3}-coverage during a test
+ run, noting which parts of the code have been executed.  They can then be
+ subsequently analyzed to identify code that could have been executed but was
+ not.
+ .
+ As they are are unlikely to be of no utility to end-users, these files should
+ be removed from the package.
+
 Tag: package-installs-python-pycache-dir
 Severity: serious
 Certainty: certain
diff --git a/checks/files.pm b/checks/files.pm
index b546cf9..57b9858 100644
--- a/checks/files.pm
+++ b/checks/files.pm
@@ -1102,6 +1102,11 @@ sub run {
             tag 'package-installs-python-egg', $file;
         }
 
+        # ---------------- .coverage (coverage.py output)
+        if ($fname =~ m,\.coverage$,o) {
+            tag 'package-contains-python-coverage-file', $file;
+        }
+
         # ---------------- /usr/lib/site-python
         if ($fname =~ m,^usr/lib/site-python/\S,) {
             tag 'file-in-usr-lib-site-python', $file;
diff --git a/t/tests/files-python-coverage/debian/.coverage b/t/tests/files-python-coverage/debian/.coverage
new file mode 100644
index 0000000..e69de29
diff --git a/t/tests/files-python-coverage/debian/debian/install b/t/tests/files-python-coverage/debian/debian/install
new file mode 100644
index 0000000..3b6a0bc
--- /dev/null
+++ b/t/tests/files-python-coverage/debian/debian/install
@@ -0,0 +1 @@
+.coverage /usr/share/files-python-coverage
diff --git a/t/tests/files-python-coverage/debian/debian/rules b/t/tests/files-python-coverage/debian/debian/rules
new file mode 100755
index 0000000..2d33f6a
--- /dev/null
+++ b/t/tests/files-python-coverage/debian/debian/rules
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@
diff --git a/t/tests/files-python-coverage/desc b/t/tests/files-python-coverage/desc
new file mode 100644
index 0000000..67126e6
--- /dev/null
+++ b/t/tests/files-python-coverage/desc
@@ -0,0 +1,6 @@
+Testname: files-python-coverage
+Sequence: 6000
+Version: 1.0
+Description: Check for Python .coverage files
+Test-For:
+ package-contains-python-coverage-file
diff --git a/t/tests/files-python-coverage/tags b/t/tests/files-python-coverage/tags
new file mode 100644
index 0000000..c943f51
--- /dev/null
+++ b/t/tests/files-python-coverage/tags
@@ -0,0 +1 @@
+W: files-python-coverage: package-contains-python-coverage-file usr/share/files-python-coverage/.coverage
-- 
2.9.3


Reply to: