aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-08-01 22:40:27 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-08-01 22:40:27 +0300
commitbd21cbc2b2fa4e7761463136c5aaf88304272e68 (patch)
treeec4b126f6dc086e7502802fdac7bad7cb5a79cab /src
parentci: test on py3.13 (diff)
downloadpkgcheck-bd21cbc2b2fa4e7761463136c5aaf88304272e68.tar.gz
pkgcheck-bd21cbc2b2fa4e7761463136c5aaf88304272e68.tar.bz2
pkgcheck-bd21cbc2b2fa4e7761463136c5aaf88304272e68.zip
EmptyGlobalAssignment: ignore empty KEYWORDS
Resolves: https://github.com/pkgcore/pkgcheck/issues/695 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/pkgcheck/checks/codingstyle.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index cfc7f8da..42bd0004 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -634,6 +634,8 @@ class MetadataVarCheck(Check):
# mapping between registered variables and verification methods
known_variables = {}
+ empty_vars_whitelist = frozenset({"KEYWORDS"})
+
@verify_vars("HOMEPAGE", "KEYWORDS")
def _raw_text(self, var, node, value, pkg):
matches = []
@@ -710,8 +712,11 @@ class MetadataVarCheck(Check):
value_str = self.canonicalize_assign(pkg.node_str(value_node)) if value_node else ""
if name in pkg.eapi.eclass_keys:
if not value_str:
- lineno, _ = node.start_point
- yield EmptyGlobalAssignment(line=pkg.node_str(node), lineno=lineno + 1, pkg=pkg)
+ if name not in self.empty_vars_whitelist:
+ lineno, _ = node.start_point
+ yield EmptyGlobalAssignment(
+ line=pkg.node_str(node), lineno=lineno + 1, pkg=pkg
+ )
elif pkg.node_str(value_node.prev_sibling) == "=":
for var_node, _ in bash.var_query.captures(value_node):
if (