Skip to content

Commit bd21cbc

Browse files
committed
EmptyGlobalAssignment: ignore empty KEYWORDS
Resolves: #695 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 603c5d1 commit bd21cbc

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

src/pkgcheck/checks/codingstyle.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,8 @@ class MetadataVarCheck(Check):
634634
# mapping between registered variables and verification methods
635635
known_variables = {}
636636

637+
empty_vars_whitelist = frozenset({"KEYWORDS"})
638+
637639
@verify_vars("HOMEPAGE", "KEYWORDS")
638640
def _raw_text(self, var, node, value, pkg):
639641
matches = []
@@ -710,8 +712,11 @@ def feed(self, pkg):
710712
value_str = self.canonicalize_assign(pkg.node_str(value_node)) if value_node else ""
711713
if name in pkg.eapi.eclass_keys:
712714
if not value_str:
713-
lineno, _ = node.start_point
714-
yield EmptyGlobalAssignment(line=pkg.node_str(node), lineno=lineno + 1, pkg=pkg)
715+
if name not in self.empty_vars_whitelist:
716+
lineno, _ = node.start_point
717+
yield EmptyGlobalAssignment(
718+
line=pkg.node_str(node), lineno=lineno + 1, pkg=pkg
719+
)
715720
elif pkg.node_str(value_node.prev_sibling) == "=":
716721
for var_node, _ in bash.var_query.captures(value_node):
717722
if (
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
{"__class__": "EmptyGlobalAssignment", "category": "DescriptionCheck", "package": "BadDescription", "version": "1", "line": "DESCRIPTION=\"\"", "lineno": 1}
2-
{"__class__": "EmptyGlobalAssignment", "category": "MetadataVarCheck", "package": "MultipleKeywordsLines", "version": "0", "line": "KEYWORDS=\"\"", "lineno": 8}
32
{"__class__": "EmptyGlobalAssignment", "category": "MetadataVarCheck", "package": "ReferenceInMetadataVar", "version": "3", "line": "LICENSE=\"\"", "lineno": 4}

0 commit comments

Comments
 (0)