Hi Niels, > Thanks for the patch! :)
Thanks again for the review. :) > If the test does not need anything special from d/rules we have a > standard one Ah, good to know... Removed. > Should the regex have a "/" (or use $basename eq '.coverage'[1])? > AFAICT this would also match "foo.coverage" Well spotted. Have replaced with $file->name eq ".coverage" which has the other advantage of catching a .coverage file installed to "/" although that admittedly would be caught by the "strange location" tag. Updated patch attached, which also corrects a grammatical error in the long tag description. Regards, -- ,''`. : :' : Chris Lamb `. `'` la...@debian.org / chris-lamb.co.uk `-
From 55d0eee57b107bd595913f737d8857677913cea6 Mon Sep 17 00:00:00 2001 From: Chris Lamb <la...@debian.org> Date: Tue, 6 Sep 2016 22:36:54 +0100 Subject: [PATCH] c/files: Warn about Python packages which ship coverage.py information. (Closes: #831864) Signed-off-by: Chris Lamb <la...@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/desc | 6 ++++++ t/tests/files-python-coverage/tags | 1 + 6 files changed, 25 insertions(+) create mode 100644 t/tests/files-python-coverage/debian/.coverage create mode 100644 t/tests/files-python-coverage/debian/debian/install 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..1400a5c 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 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..f4f7579 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 ($file->basename eq ".coverage") { + 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/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