-
Notifications
You must be signed in to change notification settings - Fork 32
DescriptionCheck: check for description repeating package name #781
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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" ?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.", "...") | ||
| ): | ||
|
|
||
| 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" |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.