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()):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't hugely care, but this blocks now feels redundant- your more specific error below is clearer than "generic package name", imo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was wondering about that too. But I figured out there's a difference between package description being completely meaningless (i.e. 100% repeat of PN) vs. having redundant prefix.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yeah, my core thought here is "generic description" doesn't really mean much.

"this is a package for python". That's generic.

"pkgcheck" for pkgcheck's description is not generic as much as someone needing a wedgie, and calling it generic is accurate, but just feels off to me.

^^^ that's bikeshedding territory, to be clear. Whatever you or others think is best works for me- the check you're adding is the one with higher value imo.

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)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there any reason to do this, rather than just saying "don't use the package name in the package description" ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Are you asking why the "is" etc. logic or the check in general?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No, I mean why should the pkgcheck package description ever need to actually use the word 'pkgcheck' in it? pkgcheck is is the english lead in for pkgcheck; is there a reason to try to catch phrases like this, rather than just saying "there's 99% no valid reason to use the package name in the description"?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Because otherwise there's a lot of false positives when package name reasonably matches what it does.

For example:

[N] dev-python/base58 ((~)2.1.1): Base58 and Base58Check implementation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Meh, but ack.

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