Skip to content

Commit

Permalink
EmptyGlobalAssignment: ignore empty KEYWORDS
Browse files Browse the repository at this point in the history
Resolves: pkgcore#695
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
  • Loading branch information
arthurzam committed Aug 1, 2024
1 parent 603c5d1 commit bd21cbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/pkgcheck/checks/codingstyle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
Expand Down Expand Up @@ -710,8 +712,11 @@ def feed(self, pkg):
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 (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
{"__class__": "EmptyGlobalAssignment", "category": "DescriptionCheck", "package": "BadDescription", "version": "1", "line": "DESCRIPTION=\"\"", "lineno": 1}
{"__class__": "EmptyGlobalAssignment", "category": "MetadataVarCheck", "package": "MultipleKeywordsLines", "version": "0", "line": "KEYWORDS=\"\"", "lineno": 8}
{"__class__": "EmptyGlobalAssignment", "category": "MetadataVarCheck", "package": "ReferenceInMetadataVar", "version": "3", "line": "LICENSE=\"\"", "lineno": 4}

0 comments on commit bd21cbc

Please sign in to comment.