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
3 changes: 3 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ pkgcheck 0.10.40 (unreleased)
- DescriptionCheck: check for descriptions ending with a full-stop (Arthur
Zamarin, Michał Górny, #472)

- DescriptionCheck: check for descriptions repeating package name (Michał
Górny, #2021)


**Packaging:**

Expand Down
7 changes: 6 additions & 1 deletion src/pkgcheck/checks/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1523,10 +1523,15 @@ class DescriptionCheck(Check):
def feed(self, pkg):
desc: str = pkg.description
s = desc.lower()
lower_pn = pkg.package.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()):
elif s in (lower_pn, pkg.key.lower()):
yield BadDescription("generic package description", pkg_desc=desc, pkg=pkg)
elif s.startswith(lower_pn) and s.removeprefix(lower_pn).startswith(
(" is", " -", ":", ",")
):
yield BadDescription("repeats package name", pkg_desc=desc, pkg=pkg)
elif desc.endswith(tuple(".,:;")) and not desc.lower().endswith(
("etc.", "co.", "inc.", "ltd.", "...")
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
{"__class__": "BadDescription", "category": "DescriptionCheck", "package": "BadDescription", "version": "2", "msg": "under 10 chars in length", "pkg_desc": "bad desc"}
{"__class__": "BadDescription", "category": "DescriptionCheck", "package": "BadDescription", "version": "3", "msg": "generic package description", "pkg_desc": "BadDescription"}
{"__class__": "BadDescription", "category": "DescriptionCheck", "package": "BadDescription", "version": "4", "msg": "over 80 chars in length", "pkg_desc": null}
{"__class__": "BadDescription", "category": "DescriptionCheck", "package": "BadDescription", "version": "5", "msg": "repeats package name", "pkg_desc": "badDESCRIPTION is a test ebuild"}
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,12 @@ diff -Naur standalone/DescriptionCheck/BadDescription/BadDescription-4.ebuild fi
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
diff -Naur standalone/DescriptionCheck/BadDescription/BadDescription-5.ebuild fixed/DescriptionCheck/BadDescription/BadDescription-5.ebuild
--- standalone/DescriptionCheck/BadDescription/BadDescription-5.ebuild 2019-11-28 00:33:38.457040594 -0700
+++ fixed/DescriptionCheck/BadDescription/BadDescription-5.ebuild 2019-11-28 00:34:59.065514420 -0700
@@ -1,4 +1,4 @@
-DESCRIPTION="badDESCRIPTION is a test ebuild"
+DESCRIPTION="Test ebuild"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
DESCRIPTION="badDESCRIPTION is a test ebuild"
HOMEPAGE="https://github.com/pkgcore/pkgcheck"
LICENSE="BSD"
SLOT="0"
Loading