aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-06-22 22:39:42 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-06-22 22:44:44 +0300
commitaefdf93fc423a08eb41d09eecb5cd376183e1660 (patch)
treefd7c97e4911ad5fdb4b78f3fff02c96204c4d623 /src
parentRustCheck: check for suboptimal cargo_crate_uris call (diff)
downloadpkgcheck-aefdf93fc423a08eb41d09eecb5cd376183e1660.tar.gz
pkgcheck-aefdf93fc423a08eb41d09eecb5cd376183e1660.tar.bz2
pkgcheck-aefdf93fc423a08eb41d09eecb5cd376183e1660.zip
MissingInherits: exclude @USER_VARIABLEs
Resolves: https://github.com/pkgcore/pkgcheck/issues/575 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/pkgcheck/checks/codingstyle.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/pkgcheck/checks/codingstyle.py b/src/pkgcheck/checks/codingstyle.py
index a9eb70fa..1ab82ad9 100644
--- a/src/pkgcheck/checks/codingstyle.py
+++ b/src/pkgcheck/checks/codingstyle.py
@@ -749,6 +749,16 @@ class InheritsCheck(Check):
for name in eclass_obj.variable_names:
self.exported.setdefault(name, set()).add(eclass)
+ # collect all @USER_VARIABLEs, which are excluded from MissingInherits
+ self.user_variables = frozenset(
+ {
+ x.name
+ for eclass_obj in self.eclass_cache.values()
+ for x in eclass_obj.variables
+ if x.user_variable
+ }
+ )
+
# register EAPI-related funcs/cmds to ignore
self.eapi_funcs = {}
for eapi in EAPI.known_eapis.values():
@@ -826,7 +836,9 @@ class InheritsCheck(Check):
if node.parent.type == "unset_command":
continue
if name not in self.eapi_vars[pkg.eapi] | assigned_vars.keys():
- lineno, colno = node.start_point
+ if name in self.user_variables:
+ continue
+ lineno, _colno = node.start_point
if eclass := self.get_eclass(name, pkg):
used[eclass].append((lineno + 1, name, name))