Skip to content

Commit bb8e305

Browse files
authored
Merge pull request #95 from olehermanse/main
2 parents 46b9a07 + d65e757 commit bb8e305

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/cfengine_cli/lint.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"string",
5353
}
5454
PROMISE_BLOCK_ATTRIBUTES = ("path", "interpreter")
55+
IMPLIES_BUNDLE = {"usebundle", "servicebundle", "service_bundle"}
5556
KNOWN_FAULTY_FUNCTION_DEFS = {"regex_replace", "peers"}
5657
# Generally, we don't want to allow creating bodies / bundles with the same
5758
# name as a built in function, as it can make things more confusing
@@ -653,7 +654,10 @@ def _lint_node(
653654
return 1
654655
if state.strict and (
655656
qualified_name not in state.bundles
656-
and qualified_name not in state.bodies
657+
and (
658+
state.attribute_name in IMPLIES_BUNDLE
659+
or qualified_name not in state.bodies
660+
)
657661
and name not in syntax_data.BUILTIN_FUNCTIONS
658662
):
659663
_highlight_range(node, lines)
@@ -764,7 +768,10 @@ def _lint_node(
764768
f"Error: Expected {expected} arguments, received {len(args)} for bundle '{call}' {location}"
765769
)
766770
return 1
767-
if qualified_name in state.bodies:
771+
if (
772+
qualified_name in state.bodies
773+
and state.attribute_name not in IMPLIES_BUNDLE
774+
):
768775
definitions = state.bodies[qualified_name]
769776
valid_counts = {len(d.get("parameters", [])) for d in definitions}
770777
if len(args) not in valid_counts:

0 commit comments

Comments
 (0)