diff --git a/src/pkgcheck/checks/metadata.py b/src/pkgcheck/checks/metadata.py index 7980942d3..958600a59 100644 --- a/src/pkgcheck/checks/metadata.py +++ b/src/pkgcheck/checks/metadata.py @@ -1358,18 +1358,20 @@ class DescriptionCheck(Check): """DESCRIPTION checks. Check on length (<=80), too short (<10), or generic (lifted from eclass or - just using the package's name). + just using the package's name), or ending with a full stop. """ known_results = frozenset([BadDescription]) def feed(self, pkg): - desc = pkg.description + desc: str = pkg.description s = desc.lower() if s.startswith("based on") and "eclass" in s: yield BadDescription("generic eclass defined description", pkg_desc=desc, pkg=pkg) elif s in (pkg.package.lower(), pkg.key.lower()): yield BadDescription("generic package description", pkg_desc=desc, pkg=pkg) + elif desc.endswith(tuple(".,:;")): + yield BadDescription("ends with a full stop", pkg_desc=desc, pkg=pkg) else: desc_len = len(desc) if not desc_len: diff --git a/testdata/data/repos/standalone/DescriptionCheck/BadDescription/fix.patch b/testdata/data/repos/standalone/DescriptionCheck/BadDescription/fix.patch index b67a84aef..08373e411 100644 --- a/testdata/data/repos/standalone/DescriptionCheck/BadDescription/fix.patch +++ b/testdata/data/repos/standalone/DescriptionCheck/BadDescription/fix.patch @@ -37,7 +37,7 @@ diff -Naur standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild fi --- standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild 2019-11-28 00:33:38.457040594 -0700 +++ fixed/DescriptionCheck/BadDescription/BadDescription-4.ebuild 2019-11-28 00:34:59.065514420 -0700 @@ -1,4 +1,4 @@ --DESCRIPTION="Ebuild with DESCRIPTION that is far too long and will be flagged by the BadDescription result since the check triggers at greater than 150 characters long." +-DESCRIPTION="Ebuild with DESCRIPTION that is far too long and will be flagged by the BadDescription result since the check triggers at greater than 150 characters long" +DESCRIPTION="Ebuild with a sane DESCRIPTION" HOMEPAGE="https://github.com/pkgcore/pkgcheck" SLOT="0" diff --git a/testdata/repos/standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild b/testdata/repos/standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild index a8d1b7276..decf1aae0 100644 --- a/testdata/repos/standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild +++ b/testdata/repos/standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild @@ -1,4 +1,4 @@ -DESCRIPTION="Ebuild with DESCRIPTION that is far too long and will be flagged by the BadDescription result since the check triggers at greater than 150 characters long." +DESCRIPTION="Ebuild with DESCRIPTION that is far too long and will be flagged by the BadDescription result since the check triggers at greater than 150 characters long" HOMEPAGE="https://github.com/pkgcore/pkgcheck" SLOT="0" LICENSE="BSD" diff --git a/tests/checks/test_metadata.py b/tests/checks/test_metadata.py index f68fb6faf..0ff4eddfb 100644 --- a/tests/checks/test_metadata.py +++ b/tests/checks/test_metadata.py @@ -29,13 +29,24 @@ def mk_pkg(self, desc=""): def test_good_desc(self): self.assertNoReport(self.check, self.mk_pkg("a perfectly written package description")) - def test_bad_descs(self): - for desc in ('based on eclass', - 'diffball', - 'dev-util/diffball', - 'foon'): - r = self.assertReport(self.check, self.mk_pkg(desc)) - assert isinstance(r, metadata.BadDescription) + @pytest.mark.parametrize('desc', ( + 'based on eclass', + 'diffball', + 'dev-util/diffball', + 'foon', + )) + def test_bad_descs(self, desc): + r = self.assertReport(self.check, self.mk_pkg(desc)) + assert isinstance(r, metadata.BadDescription) + + @pytest.mark.parametrize('desc', ( + 'some kind of description.', + 'some kind of description,', + 'some kind of description..', + )) + def test_full_stop(self, desc): + r = self.assertReport(self.check, self.mk_pkg(desc)) + assert isinstance(r, metadata.BadDescription) def test_desc_length(self): r = self.assertReport(self.check, self.mk_pkg())