Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/pkgcheck/checks/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(".,:;")):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Err but it's fine if it's a proper sentence? Unless we don't want sentence-type descriptions, then we should say that explicitly. But I don't think we want to do that.

Copy link
Member

@thesamesam thesamesam Oct 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we're clear on this. I always took the rule to be that we don't want to terminate in a full-stop. I suppose if there's a previous full stop before the end, we might want another?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I get explanation of that new rule? I'm unable to understand it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Long time ago this was considered for repoman... and, if I don't misremember, it was finally reverted because of people thinking differently on this :/
https://bugs.gentoo.org/438976

yield BadDescription("ends with a full stop", pkg_desc=desc, pkg=pkg)
else:
desc_len = len(desc)
if not desc_len:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
25 changes: 18 additions & 7 deletions tests/checks/test_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down