Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/cfengine_cli/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,9 @@ def _needs_blank_line_before(child: Node, indent: int, line_length: int) -> bool
return prev.type == "bundle_section"

if child.type == "promise":
# An @if macro already provides visual separation
if prev.type == "macro" and text(prev).startswith("@if"):
return False
# Skip past macros to find the content-bearing previous sibling,
# so we detect promise groups separated by macro-split halves.
prev_content = prev
Expand Down
26 changes: 26 additions & 0 deletions tests/format/011_macros.expected.cf
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,29 @@ bundle agent half_with_comment
string => "old_value";
@endif
}

bundle common cfe_internal_inputs
# @brief Include internal self management policies
{
vars:
enterprise_edition.(policy_server|am_policy_hub)::
"input[enterprise_hub_specific]"
string => "cfe_internal/enterprise/CFE_hub_specific.cf",
comment => "Lorem ipsum.";
@if minimum_version(3.12.0)
"input[enterprise_hub_federation]"
string => "cfe_internal/enterprise/federation/federation.cf",
comment => "Lorem ipsum.";
@endif
enterprise_edition::
"input[enterprise_knowledge]"
string => "cfe_internal/enterprise/CFE_knowledge.cf",
comment => "Lorem ipsum.";

"input[enterprise_main]"
string => "cfe_internal/enterprise/main.cf",
comment => "Lorem ipsum.";

any::
"inputs" slist => getvalues("input");
}
23 changes: 23 additions & 0 deletions tests/format/011_macros.input.cf
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,26 @@ string => "new_value";
string => "old_value";
@endif
}
bundle common cfe_internal_inputs
# @brief Include internal self management policies
{
vars:
enterprise_edition.(policy_server|am_policy_hub)::
"input[enterprise_hub_specific]"
string => "cfe_internal/enterprise/CFE_hub_specific.cf",
comment => "Lorem ipsum.";
@if minimum_version(3.12.0)
"input[enterprise_hub_federation]"
string => "cfe_internal/enterprise/federation/federation.cf",
comment => "Lorem ipsum.";
@endif
enterprise_edition::
"input[enterprise_knowledge]"
string => "cfe_internal/enterprise/CFE_knowledge.cf",
comment => "Lorem ipsum.";
"input[enterprise_main]"
string => "cfe_internal/enterprise/main.cf",
comment => "Lorem ipsum.";
any::
"inputs" slist => getvalues("input");
}
Loading