This is an automated email from the git hooks/post-receive script. lamby pushed a commit to branch master in repository lintian.
commit 5fab53fa1a0c7be2d46d1bdd414f8529dd4cc829 Author: Chris Lamb <la...@debian.org> Date: Tue Oct 10 10:35:28 2017 +0100 Check for Python modules with overly generic names such as "tests" or "test". (Closes: #875964) --- checks/files.desc | 6 ++++++ checks/files.pm | 4 ++++ debian/changelog | 2 ++ .../debian/__init__.py | 0 .../debian/debian/control.in | 15 +++++++++++++++ .../debian/debian/install | 4 ++++ .../debian/debian/rules | 5 +++++ .../debian/tests.py | 0 t/tests/files-python-module-has-overly-generic-name/desc | 5 +++++ t/tests/files-python-module-has-overly-generic-name/tags | 3 +++ 10 files changed, 44 insertions(+) diff --git a/checks/files.desc b/checks/files.desc index 8177d17..4f575b8 100644 --- a/checks/files.desc +++ b/checks/files.desc @@ -1770,3 +1770,9 @@ Certainty: certain Ref: java-policy 2 Info: Compiled Java source files must not be included in the package. These files should be removed from the package or included in <tt>.jar</tt> archives. + +Tag: python-module-has-overly-generic-name +Severity: important +Certainty: certain +Info: This package installs a Python module with an overly generic name to + a global namespace. diff --git a/checks/files.pm b/checks/files.pm index 0fa9d6e..8e6d2dc 100644 --- a/checks/files.pm +++ b/checks/files.pm @@ -1392,6 +1392,10 @@ sub run { } tag 'python-module-in-wrong-location', @correction if (@correction); + if ( $rest =~ m,^(tests?)(?:\.py|/__init__\.py)$, + and $file->is_regular_file) { + tag 'python-module-has-overly-generic-name', $fname, "($1)"; + } } if ($fname =~ m,/icons/[^/]+/(\d+)x(\d+)/(?!animations/).*\.png$,){ diff --git a/debian/changelog b/debian/changelog index eb03bdc..46529de 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ lintian (2.5.55) UNRELEASED; urgency=medium to Mattia Rizzolo for the suggestion. (Closes: #870898) * checks/files.pm: + [CL] Ignore privacy breach violations in comments. (Closes: #877421) + + [CL] Check for Python modules with overly generic names such as + "tests" or "test". (Closes: #875964) * checks/{files,manpages,menu-format}.{desc,pm}: + [NT] Stop considering usr/man, usr/X11R6/bin and usr/X11R6/man as manpage directories / PATH directories to simplify some code paths. diff --git a/t/tests/files-python-module-has-overly-generic-name/debian/__init__.py b/t/tests/files-python-module-has-overly-generic-name/debian/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/t/tests/files-python-module-has-overly-generic-name/debian/debian/control.in b/t/tests/files-python-module-has-overly-generic-name/debian/debian/control.in new file mode 100644 index 0000000..ded6626 --- /dev/null +++ b/t/tests/files-python-module-has-overly-generic-name/debian/debian/control.in @@ -0,0 +1,15 @@ +Source: {$source} +Priority: optional +Section: python +Maintainer: {$author} +Standards-Version: {$standards_version} +Build-Depends: {$build_depends} + +Package: python3-foo +Architecture: all +Depends: $\{misc:Depends\}, +Description: {$description} + This is a test package designed to exercise some feature or tag of + Lintian. It is part of the Lintian test suite and may do very odd + things. It should not be installed like a regular package. It may + be an empty package. diff --git a/t/tests/files-python-module-has-overly-generic-name/debian/debian/install b/t/tests/files-python-module-has-overly-generic-name/debian/debian/install new file mode 100644 index 0000000..3e47d77 --- /dev/null +++ b/t/tests/files-python-module-has-overly-generic-name/debian/debian/install @@ -0,0 +1,4 @@ +tests.py /usr/lib/python3/dist-packages +__init__.py /usr/lib/python3/dist-packages/test/ +__init__.py /usr/lib/python3/dist-packages/tests/ +__init__.py /usr/lib/python3/dist-packages/false_positive/ diff --git a/t/tests/files-python-module-has-overly-generic-name/debian/debian/rules b/t/tests/files-python-module-has-overly-generic-name/debian/debian/rules new file mode 100644 index 0000000..abde6ef --- /dev/null +++ b/t/tests/files-python-module-has-overly-generic-name/debian/debian/rules @@ -0,0 +1,5 @@ +#!/usr/bin/make -f + +%: + dh $@ + diff --git a/t/tests/files-python-module-has-overly-generic-name/debian/tests.py b/t/tests/files-python-module-has-overly-generic-name/debian/tests.py new file mode 100644 index 0000000..e69de29 diff --git a/t/tests/files-python-module-has-overly-generic-name/desc b/t/tests/files-python-module-has-overly-generic-name/desc new file mode 100644 index 0000000..416b84e --- /dev/null +++ b/t/tests/files-python-module-has-overly-generic-name/desc @@ -0,0 +1,5 @@ +Testname: files-python-module-has-overly-generic-name +Version: 1.0 +Description: Test tags for Python modules with overly generic names +Test-For: + python-module-has-overly-generic-name diff --git a/t/tests/files-python-module-has-overly-generic-name/tags b/t/tests/files-python-module-has-overly-generic-name/tags new file mode 100644 index 0000000..56c958d --- /dev/null +++ b/t/tests/files-python-module-has-overly-generic-name/tags @@ -0,0 +1,3 @@ +E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packages/test/__init__.py (test) +E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packages/tests.py (tests) +E: python3-foo: python-module-has-overly-generic-name usr/lib/python3/dist-packages/tests/__init__.py (tests) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git