|
52 | 52 | "string", |
53 | 53 | } |
54 | 54 | PROMISE_BLOCK_ATTRIBUTES = ("path", "interpreter") |
| 55 | +IMPLIES_BUNDLE = {"usebundle", "servicebundle", "service_bundle"} |
55 | 56 | KNOWN_FAULTY_FUNCTION_DEFS = {"regex_replace", "peers"} |
56 | 57 | # Generally, we don't want to allow creating bodies / bundles with the same |
57 | 58 | # name as a built in function, as it can make things more confusing |
@@ -653,7 +654,10 @@ def _lint_node( |
653 | 654 | return 1 |
654 | 655 | if state.strict and ( |
655 | 656 | 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 | + ) |
657 | 661 | and name not in syntax_data.BUILTIN_FUNCTIONS |
658 | 662 | ): |
659 | 663 | _highlight_range(node, lines) |
@@ -764,7 +768,10 @@ def _lint_node( |
764 | 768 | f"Error: Expected {expected} arguments, received {len(args)} for bundle '{call}' {location}" |
765 | 769 | ) |
766 | 770 | 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 | + ): |
768 | 775 | definitions = state.bodies[qualified_name] |
769 | 776 | valid_counts = {len(d.get("parameters", [])) for d in definitions} |
770 | 777 | if len(args) not in valid_counts: |
|
0 commit comments