From a5946178d0c32488ea31750f92c8f0a09c44fe44 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 14:44:53 +0200 Subject: [PATCH 1/6] cfengine lint: Added support for deprecated str attribute in vars promises Signed-off-by: Ole Herman Schumacher Elgesem --- src/cfengine_cli/lint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cfengine_cli/lint.py b/src/cfengine_cli/lint.py index 55ce7ca..d3414aa 100644 --- a/src/cfengine_cli/lint.py +++ b/src/cfengine_cli/lint.py @@ -50,6 +50,7 @@ "rlist", "slist", "string", + "str", # deprecated shorthand for string } PROMISE_BLOCK_ATTRIBUTES = ("path", "interpreter") @@ -775,6 +776,10 @@ def _lint_attribute_name( """Check an attribute name for deprecations and validity according to the surrounding promise type.""" assert node.type == "attribute_name" + if state.strict and state.promise_type == "vars" and _text(node) == "str": + raise ValidationError( + f"Deprecation: Use 'string' instead of 'str' {location}", node + ) if state.strict and _text(node) == "ifvarclass": raise ValidationError( f"Deprecation: Use 'if' instead of 'ifvarclass' {location}", node From 2e915bcb6dd3af2b8f684c551fadf134c8bee39b Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 14:51:05 +0200 Subject: [PATCH 2/6] cfengine lint: Small refactoring for _lint_attribute_name() Signed-off-by: Ole Herman Schumacher Elgesem --- src/cfengine_cli/lint.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cfengine_cli/lint.py b/src/cfengine_cli/lint.py index d3414aa..0a75992 100644 --- a/src/cfengine_cli/lint.py +++ b/src/cfengine_cli/lint.py @@ -776,15 +776,17 @@ def _lint_attribute_name( """Check an attribute name for deprecations and validity according to the surrounding promise type.""" assert node.type == "attribute_name" - if state.strict and state.promise_type == "vars" and _text(node) == "str": + attribute_name = _text(node) + assert attribute_name == state.attribute_name + if state.strict and state.promise_type == "vars" and attribute_name == "str": raise ValidationError( f"Deprecation: Use 'string' instead of 'str' {location}", node ) - if state.strict and _text(node) == "ifvarclass": + if state.strict and attribute_name == "ifvarclass": raise ValidationError( f"Deprecation: Use 'if' instead of 'ifvarclass' {location}", node ) - if state.promise_type and state.attribute_name: + if state.promise_type and attribute_name: promise_type_data = syntax_data.BUILTIN_PROMISE_TYPES.get( state.promise_type, {} ) @@ -792,17 +794,17 @@ def _lint_attribute_name( # Custom promise type - we cannot validate attribute name here. return promise_type_attrs = promise_type_data.get("attributes", {}) - if state.attribute_name not in promise_type_attrs: + if attribute_name not in promise_type_attrs: raise ValidationError( - f"Error: Invalid attribute '{state.attribute_name}' for promise type '{state.promise_type}' {location}", + f"Error: Invalid attribute '{attribute_name}' for promise type '{state.promise_type}' {location}", node, ) - if state.block_keyword == "promise" and state.attribute_name not in ( + if state.block_keyword == "promise" and attribute_name not in ( None, *PROMISE_BLOCK_ATTRIBUTES, ): raise ValidationError( - f"Error: Invalid attribute name '{state.attribute_name}' in '{state.block_name}' custom promise type definition {location}", + f"Error: Invalid attribute name '{attribute_name}' in '{state.block_name}' custom promise type definition {location}", node, ) From 10687119c6299e85ea3cf0be72cebe2ec32ae18d Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 14:58:10 +0200 Subject: [PATCH 3/6] tests: Combined deprecation tests into 1 file Co-authored-by: Claude Opus 4.7 (1M context) Signed-off-by: Ole Herman Schumacher Elgesem --- tests/lint/002_deprecations.expected.txt | 12 ++++++++++++ .../{002_ifvarclass.x.cf => 002_deprecations.x.cf} | 2 ++ tests/lint/002_ifvarclass.expected.txt | 7 ------- tests/lint/003_deprecated_promise_type.cf | 5 ----- tests/lint/003_deprecated_promise_type.expected.txt | 7 ------- tests/lint/003_deprecated_promise_type.x.cf | 5 ----- 6 files changed, 14 insertions(+), 24 deletions(-) create mode 100644 tests/lint/002_deprecations.expected.txt rename tests/lint/{002_ifvarclass.x.cf => 002_deprecations.x.cf} (69%) delete mode 100644 tests/lint/002_ifvarclass.expected.txt delete mode 100644 tests/lint/003_deprecated_promise_type.cf delete mode 100644 tests/lint/003_deprecated_promise_type.expected.txt delete mode 100644 tests/lint/003_deprecated_promise_type.x.cf diff --git a/tests/lint/002_deprecations.expected.txt b/tests/lint/002_deprecations.expected.txt new file mode 100644 index 0000000..7befc97 --- /dev/null +++ b/tests/lint/002_deprecations.expected.txt @@ -0,0 +1,12 @@ + +{ + defaults: + ^-------^ +Deprecation: Promise type 'defaults' is deprecated at tests/lint/002_deprecations.x.cf:3:3 + + "Hello, CFEngine" + ifvarclass => "cfengine"; + ^--------^ +Deprecation: Use 'if' instead of 'ifvarclass' at tests/lint/002_deprecations.x.cf:7:7 +FAIL: tests/lint/002_deprecations.x.cf (2 errors) +Failure, 2 errors in total. diff --git a/tests/lint/002_ifvarclass.x.cf b/tests/lint/002_deprecations.x.cf similarity index 69% rename from tests/lint/002_ifvarclass.x.cf rename to tests/lint/002_deprecations.x.cf index 984f715..d915012 100644 --- a/tests/lint/002_ifvarclass.x.cf +++ b/tests/lint/002_deprecations.x.cf @@ -1,5 +1,7 @@ bundle agent main { + defaults: + "x" string => "value"; reports: "Hello, CFEngine" ifvarclass => "cfengine"; diff --git a/tests/lint/002_ifvarclass.expected.txt b/tests/lint/002_ifvarclass.expected.txt deleted file mode 100644 index 6ffa1cb..0000000 --- a/tests/lint/002_ifvarclass.expected.txt +++ /dev/null @@ -1,7 +0,0 @@ - - "Hello, CFEngine" - ifvarclass => "cfengine"; - ^--------^ -Deprecation: Use 'if' instead of 'ifvarclass' at tests/lint/002_ifvarclass.x.cf:5:7 -FAIL: tests/lint/002_ifvarclass.x.cf (1 error) -Failure, 1 error in total. diff --git a/tests/lint/003_deprecated_promise_type.cf b/tests/lint/003_deprecated_promise_type.cf deleted file mode 100644 index bc55af2..0000000 --- a/tests/lint/003_deprecated_promise_type.cf +++ /dev/null @@ -1,5 +0,0 @@ -bundle agent main -{ - vars: - "x" string => "value"; -} diff --git a/tests/lint/003_deprecated_promise_type.expected.txt b/tests/lint/003_deprecated_promise_type.expected.txt deleted file mode 100644 index 36f78b3..0000000 --- a/tests/lint/003_deprecated_promise_type.expected.txt +++ /dev/null @@ -1,7 +0,0 @@ - -{ - defaults: - ^-------^ -Deprecation: Promise type 'defaults' is deprecated at tests/lint/003_deprecated_promise_type.x.cf:3:3 -FAIL: tests/lint/003_deprecated_promise_type.x.cf (1 error) -Failure, 1 error in total. diff --git a/tests/lint/003_deprecated_promise_type.x.cf b/tests/lint/003_deprecated_promise_type.x.cf deleted file mode 100644 index b845f35..0000000 --- a/tests/lint/003_deprecated_promise_type.x.cf +++ /dev/null @@ -1,5 +0,0 @@ -bundle agent main -{ - defaults: - "x" string => "value"; -} From 05d6820e06e9cab9232fad5147c9318eaf1f1ba9 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 15:06:20 +0200 Subject: [PATCH 4/6] tests: Reordered linting tests after merging 2 of them Co-authored-by: Claude Opus 4.7 (1M context) Signed-off-by: Ole Herman Schumacher Elgesem --- ...wercase.cf => 003_bundle_name_lowercase.cf} | 0 .../003_bundle_name_lowercase.expected.txt | 6 ++++++ ...ase.x.cf => 003_bundle_name_lowercase.x.cf} | 0 .../004_bundle_name_lowercase.expected.txt | 6 ------ .../{005_bundle_type.cf => 004_bundle_type.cf} | 0 ...pected.txt => 004_bundle_type.expected.txt} | 4 ++-- ...5_bundle_type.x.cf => 004_bundle_type.x.cf} | 0 ...006_syntax_error.cf => 005_syntax_error.cf} | 0 tests/lint/005_syntax_error.expected.txt | 7 +++++++ ...syntax_error.x.cf => 005_syntax_error.x.cf} | 0 tests/lint/006_empty_file.expected.txt | 3 +++ ...007_empty_file.x.cf => 006_empty_file.x.cf} | 0 tests/lint/006_syntax_error.expected.txt | 7 ------- tests/lint/007_empty_file.expected.txt | 3 --- .../{008_namespace.cf => 007_namespace.cf} | 0 ...expected.txt => 007_namespace.expected.txt} | 4 ++-- .../{008_namespace.x.cf => 007_namespace.x.cf} | 0 ...ction.cf => 008_bundle_shadows_function.cf} | 0 ...> 008_bundle_shadows_function.expected.txt} | 4 ++-- ...n.x.cf => 008_bundle_shadows_function.x.cf} | 0 ....cf => 009_unknown_function_inside_vars.cf} | 0 ..._unknown_function_inside_vars.expected.txt} | 6 +++--- ...f => 009_unknown_function_inside_vars.x.cf} | 0 ...cf => 010_mutually_exclusive_types_vars.cf} | 0 ...mutually_exclusive_types_vars.expected.txt} | 6 +++--- ... => 010_mutually_exclusive_types_vars.x.cf} | 0 ...txt => 011_invalid_attributes.expected.txt} | 6 +++--- ...ibutes.x.cf => 011_invalid_attributes.x.cf} | 0 ...count.cf => 012_function_call_arg_count.cf} | 0 ...> 012_function_call_arg_count.expected.txt} | 6 +++--- ...t.x.cf => 012_function_call_arg_count.x.cf} | 0 ...cted.txt => 013_num_args_body.expected.txt} | 14 +++++++------- ...m_args_body.x.cf => 013_num_args_body.x.cf} | 0 ...ed.txt => 013_num_args_bundle.expected.txt} | 14 +++++++------- ...gs_bundle.x.cf => 013_num_args_bundle.x.cf} | 0 ...dle_body.cf => 013_num_args_bundle_body.cf} | 0 ...count.cf => 014_variadic_func_arg_count.cf} | 0 ...> 014_variadic_func_arg_count.expected.txt} | 6 +++--- ...t.x.cf => 014_variadic_func_arg_count.x.cf} | 0 ...bundle.cf => 015_macro_multi_def_bundle.cf} | 0 .../015_macro_multi_def_bundle.expected.txt | 14 ++++++++++++++ ...le.x.cf => 015_macro_multi_def_bundle.x.cf} | 0 ...7_half_promises.cf => 016_half_promises.cf} | 0 ...cted.txt => 016_half_promises.expected.txt} | 8 ++++---- ...lf_promises.x.cf => 016_half_promises.x.cf} | 0 .../016_macro_multi_def_bundle.expected.txt | 14 -------------- ...018_implies_body.cf => 017_implies_body.cf} | 0 ...ected.txt => 017_implies_body.expected.txt} | 18 +++++++++--------- ...implies_body.x.cf => 017_implies_body.x.cf} | 0 ...019_nested_calls.cf => 018_nested_calls.cf} | 0 ...ected.txt => 018_nested_calls.expected.txt} | 10 +++++----- ...nested_calls.x.cf => 018_nested_calls.x.cf} | 0 ...pansion.cf => 019_bundle_name_expansion.cf} | 0 53 files changed, 83 insertions(+), 83 deletions(-) rename tests/lint/{004_bundle_name_lowercase.cf => 003_bundle_name_lowercase.cf} (100%) create mode 100644 tests/lint/003_bundle_name_lowercase.expected.txt rename tests/lint/{004_bundle_name_lowercase.x.cf => 003_bundle_name_lowercase.x.cf} (100%) delete mode 100644 tests/lint/004_bundle_name_lowercase.expected.txt rename tests/lint/{005_bundle_type.cf => 004_bundle_type.cf} (100%) rename tests/lint/{005_bundle_type.expected.txt => 004_bundle_type.expected.txt} (59%) rename tests/lint/{005_bundle_type.x.cf => 004_bundle_type.x.cf} (100%) rename tests/lint/{006_syntax_error.cf => 005_syntax_error.cf} (100%) create mode 100644 tests/lint/005_syntax_error.expected.txt rename tests/lint/{006_syntax_error.x.cf => 005_syntax_error.x.cf} (100%) create mode 100644 tests/lint/006_empty_file.expected.txt rename tests/lint/{007_empty_file.x.cf => 006_empty_file.x.cf} (100%) delete mode 100644 tests/lint/006_syntax_error.expected.txt delete mode 100644 tests/lint/007_empty_file.expected.txt rename tests/lint/{008_namespace.cf => 007_namespace.cf} (100%) rename tests/lint/{008_namespace.expected.txt => 007_namespace.expected.txt} (56%) rename tests/lint/{008_namespace.x.cf => 007_namespace.x.cf} (100%) rename tests/lint/{009_bundle_shadows_function.cf => 008_bundle_shadows_function.cf} (100%) rename tests/lint/{009_bundle_shadows_function.expected.txt => 008_bundle_shadows_function.expected.txt} (53%) rename tests/lint/{009_bundle_shadows_function.x.cf => 008_bundle_shadows_function.x.cf} (100%) rename tests/lint/{010_unknown_function_inside_vars.cf => 009_unknown_function_inside_vars.cf} (100%) rename tests/lint/{010_unknown_function_inside_vars.expected.txt => 009_unknown_function_inside_vars.expected.txt} (62%) rename tests/lint/{010_unknown_function_inside_vars.x.cf => 009_unknown_function_inside_vars.x.cf} (100%) rename tests/lint/{011_mutually_exclusive_types_vars.cf => 010_mutually_exclusive_types_vars.cf} (100%) rename tests/lint/{011_mutually_exclusive_types_vars.expected.txt => 010_mutually_exclusive_types_vars.expected.txt} (62%) rename tests/lint/{011_mutually_exclusive_types_vars.x.cf => 010_mutually_exclusive_types_vars.x.cf} (100%) rename tests/lint/{012_invalid_attributes.expected.txt => 011_invalid_attributes.expected.txt} (65%) rename tests/lint/{012_invalid_attributes.x.cf => 011_invalid_attributes.x.cf} (100%) rename tests/lint/{013_function_call_arg_count.cf => 012_function_call_arg_count.cf} (100%) rename tests/lint/{013_function_call_arg_count.expected.txt => 012_function_call_arg_count.expected.txt} (65%) rename tests/lint/{013_function_call_arg_count.x.cf => 012_function_call_arg_count.x.cf} (100%) rename tests/lint/{014_num_args_body.expected.txt => 013_num_args_body.expected.txt} (61%) rename tests/lint/{014_num_args_body.x.cf => 013_num_args_body.x.cf} (100%) rename tests/lint/{014_num_args_bundle.expected.txt => 013_num_args_bundle.expected.txt} (58%) rename tests/lint/{014_num_args_bundle.x.cf => 013_num_args_bundle.x.cf} (100%) rename tests/lint/{014_num_args_bundle_body.cf => 013_num_args_bundle_body.cf} (100%) rename tests/lint/{015_variadic_func_arg_count.cf => 014_variadic_func_arg_count.cf} (100%) rename tests/lint/{015_variadic_func_arg_count.expected.txt => 014_variadic_func_arg_count.expected.txt} (74%) rename tests/lint/{015_variadic_func_arg_count.x.cf => 014_variadic_func_arg_count.x.cf} (100%) rename tests/lint/{016_macro_multi_def_bundle.cf => 015_macro_multi_def_bundle.cf} (100%) create mode 100644 tests/lint/015_macro_multi_def_bundle.expected.txt rename tests/lint/{016_macro_multi_def_bundle.x.cf => 015_macro_multi_def_bundle.x.cf} (100%) rename tests/lint/{017_half_promises.cf => 016_half_promises.cf} (100%) rename tests/lint/{017_half_promises.expected.txt => 016_half_promises.expected.txt} (66%) rename tests/lint/{017_half_promises.x.cf => 016_half_promises.x.cf} (100%) delete mode 100644 tests/lint/016_macro_multi_def_bundle.expected.txt rename tests/lint/{018_implies_body.cf => 017_implies_body.cf} (100%) rename tests/lint/{018_implies_body.expected.txt => 017_implies_body.expected.txt} (71%) rename tests/lint/{018_implies_body.x.cf => 017_implies_body.x.cf} (100%) rename tests/lint/{019_nested_calls.cf => 018_nested_calls.cf} (100%) rename tests/lint/{019_nested_calls.expected.txt => 018_nested_calls.expected.txt} (70%) rename tests/lint/{019_nested_calls.x.cf => 018_nested_calls.x.cf} (100%) rename tests/lint/{020_bundle_name_expansion.cf => 019_bundle_name_expansion.cf} (100%) diff --git a/tests/lint/004_bundle_name_lowercase.cf b/tests/lint/003_bundle_name_lowercase.cf similarity index 100% rename from tests/lint/004_bundle_name_lowercase.cf rename to tests/lint/003_bundle_name_lowercase.cf diff --git a/tests/lint/003_bundle_name_lowercase.expected.txt b/tests/lint/003_bundle_name_lowercase.expected.txt new file mode 100644 index 0000000..8a01374 --- /dev/null +++ b/tests/lint/003_bundle_name_lowercase.expected.txt @@ -0,0 +1,6 @@ + +bundle agent MyBundle + ^------^ +Convention: Bundle name should be lowercase at tests/lint/003_bundle_name_lowercase.x.cf:1:14 +FAIL: tests/lint/003_bundle_name_lowercase.x.cf (1 error) +Failure, 1 error in total. diff --git a/tests/lint/004_bundle_name_lowercase.x.cf b/tests/lint/003_bundle_name_lowercase.x.cf similarity index 100% rename from tests/lint/004_bundle_name_lowercase.x.cf rename to tests/lint/003_bundle_name_lowercase.x.cf diff --git a/tests/lint/004_bundle_name_lowercase.expected.txt b/tests/lint/004_bundle_name_lowercase.expected.txt deleted file mode 100644 index 484d04e..0000000 --- a/tests/lint/004_bundle_name_lowercase.expected.txt +++ /dev/null @@ -1,6 +0,0 @@ - -bundle agent MyBundle - ^------^ -Convention: Bundle name should be lowercase at tests/lint/004_bundle_name_lowercase.x.cf:1:14 -FAIL: tests/lint/004_bundle_name_lowercase.x.cf (1 error) -Failure, 1 error in total. diff --git a/tests/lint/005_bundle_type.cf b/tests/lint/004_bundle_type.cf similarity index 100% rename from tests/lint/005_bundle_type.cf rename to tests/lint/004_bundle_type.cf diff --git a/tests/lint/005_bundle_type.expected.txt b/tests/lint/004_bundle_type.expected.txt similarity index 59% rename from tests/lint/005_bundle_type.expected.txt rename to tests/lint/004_bundle_type.expected.txt index cfaa2bc..b650af3 100644 --- a/tests/lint/005_bundle_type.expected.txt +++ b/tests/lint/004_bundle_type.expected.txt @@ -1,6 +1,6 @@ bundle notavalidtype my_bundle ^-----------^ -Error: Bundle type must be one of (agent, common, edit_line, edit_xml, monitor, server), not 'notavalidtype' at tests/lint/005_bundle_type.x.cf:1:8 -FAIL: tests/lint/005_bundle_type.x.cf (1 error) +Error: Bundle type must be one of (agent, common, edit_line, edit_xml, monitor, server), not 'notavalidtype' at tests/lint/004_bundle_type.x.cf:1:8 +FAIL: tests/lint/004_bundle_type.x.cf (1 error) Failure, 1 error in total. diff --git a/tests/lint/005_bundle_type.x.cf b/tests/lint/004_bundle_type.x.cf similarity index 100% rename from tests/lint/005_bundle_type.x.cf rename to tests/lint/004_bundle_type.x.cf diff --git a/tests/lint/006_syntax_error.cf b/tests/lint/005_syntax_error.cf similarity index 100% rename from tests/lint/006_syntax_error.cf rename to tests/lint/005_syntax_error.cf diff --git a/tests/lint/005_syntax_error.expected.txt b/tests/lint/005_syntax_error.expected.txt new file mode 100644 index 0000000..b928b97 --- /dev/null +++ b/tests/lint/005_syntax_error.expected.txt @@ -0,0 +1,7 @@ + +{ + reports + ^-----^ +Error: Syntax error at tests/lint/005_syntax_error.x.cf:3:3 +FAIL: tests/lint/005_syntax_error.x.cf (1 error) +Failure, 1 error in total. diff --git a/tests/lint/006_syntax_error.x.cf b/tests/lint/005_syntax_error.x.cf similarity index 100% rename from tests/lint/006_syntax_error.x.cf rename to tests/lint/005_syntax_error.x.cf diff --git a/tests/lint/006_empty_file.expected.txt b/tests/lint/006_empty_file.expected.txt new file mode 100644 index 0000000..5f0ef94 --- /dev/null +++ b/tests/lint/006_empty_file.expected.txt @@ -0,0 +1,3 @@ +Error: Empty policy file 'tests/lint/006_empty_file.x.cf' +FAIL: tests/lint/006_empty_file.x.cf (1 error) +Failure, 1 error in total. diff --git a/tests/lint/007_empty_file.x.cf b/tests/lint/006_empty_file.x.cf similarity index 100% rename from tests/lint/007_empty_file.x.cf rename to tests/lint/006_empty_file.x.cf diff --git a/tests/lint/006_syntax_error.expected.txt b/tests/lint/006_syntax_error.expected.txt deleted file mode 100644 index de31969..0000000 --- a/tests/lint/006_syntax_error.expected.txt +++ /dev/null @@ -1,7 +0,0 @@ - -{ - reports - ^-----^ -Error: Syntax error at tests/lint/006_syntax_error.x.cf:3:3 -FAIL: tests/lint/006_syntax_error.x.cf (1 error) -Failure, 1 error in total. diff --git a/tests/lint/007_empty_file.expected.txt b/tests/lint/007_empty_file.expected.txt deleted file mode 100644 index 8d17cd1..0000000 --- a/tests/lint/007_empty_file.expected.txt +++ /dev/null @@ -1,3 +0,0 @@ -Error: Empty policy file 'tests/lint/007_empty_file.x.cf' -FAIL: tests/lint/007_empty_file.x.cf (1 error) -Failure, 1 error in total. diff --git a/tests/lint/008_namespace.cf b/tests/lint/007_namespace.cf similarity index 100% rename from tests/lint/008_namespace.cf rename to tests/lint/007_namespace.cf diff --git a/tests/lint/008_namespace.expected.txt b/tests/lint/007_namespace.expected.txt similarity index 56% rename from tests/lint/008_namespace.expected.txt rename to tests/lint/007_namespace.expected.txt index 58634ad..0d901ec 100644 --- a/tests/lint/008_namespace.expected.txt +++ b/tests/lint/007_namespace.expected.txt @@ -2,6 +2,6 @@ methods: "x" usebundle => default:target("arg"); ^------------^ -Error: Call to unknown bundle 'default:target' at tests/lint/008_namespace.x.cf:15:22 -FAIL: tests/lint/008_namespace.x.cf (1 error) +Error: Call to unknown bundle 'default:target' at tests/lint/007_namespace.x.cf:15:22 +FAIL: tests/lint/007_namespace.x.cf (1 error) Failure, 1 error in total. diff --git a/tests/lint/008_namespace.x.cf b/tests/lint/007_namespace.x.cf similarity index 100% rename from tests/lint/008_namespace.x.cf rename to tests/lint/007_namespace.x.cf diff --git a/tests/lint/009_bundle_shadows_function.cf b/tests/lint/008_bundle_shadows_function.cf similarity index 100% rename from tests/lint/009_bundle_shadows_function.cf rename to tests/lint/008_bundle_shadows_function.cf diff --git a/tests/lint/009_bundle_shadows_function.expected.txt b/tests/lint/008_bundle_shadows_function.expected.txt similarity index 53% rename from tests/lint/009_bundle_shadows_function.expected.txt rename to tests/lint/008_bundle_shadows_function.expected.txt index 4ad2733..1b01a73 100644 --- a/tests/lint/009_bundle_shadows_function.expected.txt +++ b/tests/lint/008_bundle_shadows_function.expected.txt @@ -1,6 +1,6 @@ bundle agent isvariable ^--------^ -Error: Bundle 'isvariable' conflicts with built-in function with the same name at tests/lint/009_bundle_shadows_function.x.cf:1:14 -FAIL: tests/lint/009_bundle_shadows_function.x.cf (1 error) +Error: Bundle 'isvariable' conflicts with built-in function with the same name at tests/lint/008_bundle_shadows_function.x.cf:1:14 +FAIL: tests/lint/008_bundle_shadows_function.x.cf (1 error) Failure, 1 error in total. diff --git a/tests/lint/009_bundle_shadows_function.x.cf b/tests/lint/008_bundle_shadows_function.x.cf similarity index 100% rename from tests/lint/009_bundle_shadows_function.x.cf rename to tests/lint/008_bundle_shadows_function.x.cf diff --git a/tests/lint/010_unknown_function_inside_vars.cf b/tests/lint/009_unknown_function_inside_vars.cf similarity index 100% rename from tests/lint/010_unknown_function_inside_vars.cf rename to tests/lint/009_unknown_function_inside_vars.cf diff --git a/tests/lint/010_unknown_function_inside_vars.expected.txt b/tests/lint/009_unknown_function_inside_vars.expected.txt similarity index 62% rename from tests/lint/010_unknown_function_inside_vars.expected.txt rename to tests/lint/009_unknown_function_inside_vars.expected.txt index ce55a44..6d07bd9 100644 --- a/tests/lint/010_unknown_function_inside_vars.expected.txt +++ b/tests/lint/009_unknown_function_inside_vars.expected.txt @@ -2,11 +2,11 @@ vars: "x" string => target("arg"); ^----^ -Error: Call to unknown function 'target' inside 'vars'-promise at tests/lint/010_unknown_function_inside_vars.x.cf:16:19 +Error: Call to unknown function 'target' inside 'vars'-promise at tests/lint/009_unknown_function_inside_vars.x.cf:16:19 "y" classes => isvariable("arg"), ^--------^ -Error: 'isvariable' is not a defined body. Only bodies may be called with 'classes' at tests/lint/010_unknown_function_inside_vars.x.cf:18:18 -FAIL: tests/lint/010_unknown_function_inside_vars.x.cf (2 errors) +Error: 'isvariable' is not a defined body. Only bodies may be called with 'classes' at tests/lint/009_unknown_function_inside_vars.x.cf:18:18 +FAIL: tests/lint/009_unknown_function_inside_vars.x.cf (2 errors) Failure, 2 errors in total. diff --git a/tests/lint/010_unknown_function_inside_vars.x.cf b/tests/lint/009_unknown_function_inside_vars.x.cf similarity index 100% rename from tests/lint/010_unknown_function_inside_vars.x.cf rename to tests/lint/009_unknown_function_inside_vars.x.cf diff --git a/tests/lint/011_mutually_exclusive_types_vars.cf b/tests/lint/010_mutually_exclusive_types_vars.cf similarity index 100% rename from tests/lint/011_mutually_exclusive_types_vars.cf rename to tests/lint/010_mutually_exclusive_types_vars.cf diff --git a/tests/lint/011_mutually_exclusive_types_vars.expected.txt b/tests/lint/010_mutually_exclusive_types_vars.expected.txt similarity index 62% rename from tests/lint/011_mutually_exclusive_types_vars.expected.txt rename to tests/lint/010_mutually_exclusive_types_vars.expected.txt index d980510..2544b58 100644 --- a/tests/lint/011_mutually_exclusive_types_vars.expected.txt +++ b/tests/lint/010_mutually_exclusive_types_vars.expected.txt @@ -2,11 +2,11 @@ policy => "free", real => "0.5"; ^--^ -Error: Mutually exclusive attribute values (slist, int, real) for a single promiser inside vars-promise at tests/lint/011_mutually_exclusive_types_vars.x.cf:4:5 +Error: Mutually exclusive attribute values (slist, int, real) for a single promiser inside vars-promise at tests/lint/010_mutually_exclusive_types_vars.x.cf:4:5 "missing-error"; ^--------------^ -Error: Missing value for vars promise "missing-error" at tests/lint/011_mutually_exclusive_types_vars.x.cf:16:5 -FAIL: tests/lint/011_mutually_exclusive_types_vars.x.cf (2 errors) +Error: Missing value for vars promise "missing-error" at tests/lint/010_mutually_exclusive_types_vars.x.cf:16:5 +FAIL: tests/lint/010_mutually_exclusive_types_vars.x.cf (2 errors) Failure, 2 errors in total. diff --git a/tests/lint/011_mutually_exclusive_types_vars.x.cf b/tests/lint/010_mutually_exclusive_types_vars.x.cf similarity index 100% rename from tests/lint/011_mutually_exclusive_types_vars.x.cf rename to tests/lint/010_mutually_exclusive_types_vars.x.cf diff --git a/tests/lint/012_invalid_attributes.expected.txt b/tests/lint/011_invalid_attributes.expected.txt similarity index 65% rename from tests/lint/012_invalid_attributes.expected.txt rename to tests/lint/011_invalid_attributes.expected.txt index b54202f..4b07dd9 100644 --- a/tests/lint/012_invalid_attributes.expected.txt +++ b/tests/lint/011_invalid_attributes.expected.txt @@ -2,11 +2,11 @@ path => "/var/cfengine/inputs/modules/promises/git.py"; blah => "something"; ^--^ -Error: Invalid attribute name 'blah' in 'git' custom promise type definition at tests/lint/012_invalid_attributes.x.cf:5:3 +Error: Invalid attribute name 'blah' in 'git' custom promise type definition at tests/lint/011_invalid_attributes.x.cf:5:3 slist => {}, bar => ""; ^-^ -Error: Invalid attribute 'bar' for promise type 'vars' at tests/lint/012_invalid_attributes.x.cf:12:7 -FAIL: tests/lint/012_invalid_attributes.x.cf (2 errors) +Error: Invalid attribute 'bar' for promise type 'vars' at tests/lint/011_invalid_attributes.x.cf:12:7 +FAIL: tests/lint/011_invalid_attributes.x.cf (2 errors) Failure, 2 errors in total. diff --git a/tests/lint/012_invalid_attributes.x.cf b/tests/lint/011_invalid_attributes.x.cf similarity index 100% rename from tests/lint/012_invalid_attributes.x.cf rename to tests/lint/011_invalid_attributes.x.cf diff --git a/tests/lint/013_function_call_arg_count.cf b/tests/lint/012_function_call_arg_count.cf similarity index 100% rename from tests/lint/013_function_call_arg_count.cf rename to tests/lint/012_function_call_arg_count.cf diff --git a/tests/lint/013_function_call_arg_count.expected.txt b/tests/lint/012_function_call_arg_count.expected.txt similarity index 65% rename from tests/lint/013_function_call_arg_count.expected.txt rename to tests/lint/012_function_call_arg_count.expected.txt index 6aef66d..a007461 100644 --- a/tests/lint/013_function_call_arg_count.expected.txt +++ b/tests/lint/012_function_call_arg_count.expected.txt @@ -2,11 +2,11 @@ "string1" string => canonify(); ^--------^ -Error: Expected 1 arguments, received 0 for function 'canonify' at tests/lint/013_function_call_arg_count.x.cf:5:15 +Error: Expected 1 arguments, received 0 for function 'canonify' at tests/lint/012_function_call_arg_count.x.cf:5:15 "string3" string => canonify("test", "test"); ^----------------------^ -Error: Expected 1 arguments, received 2 for function 'canonify' at tests/lint/013_function_call_arg_count.x.cf:9:15 -FAIL: tests/lint/013_function_call_arg_count.x.cf (2 errors) +Error: Expected 1 arguments, received 2 for function 'canonify' at tests/lint/012_function_call_arg_count.x.cf:9:15 +FAIL: tests/lint/012_function_call_arg_count.x.cf (2 errors) Failure, 2 errors in total. diff --git a/tests/lint/013_function_call_arg_count.x.cf b/tests/lint/012_function_call_arg_count.x.cf similarity index 100% rename from tests/lint/013_function_call_arg_count.x.cf rename to tests/lint/012_function_call_arg_count.x.cf diff --git a/tests/lint/014_num_args_body.expected.txt b/tests/lint/013_num_args_body.expected.txt similarity index 61% rename from tests/lint/014_num_args_body.expected.txt rename to tests/lint/013_num_args_body.expected.txt index 98d5b5a..81bc6f7 100644 --- a/tests/lint/014_num_args_body.expected.txt +++ b/tests/lint/013_num_args_body.expected.txt @@ -2,19 +2,19 @@ create => "true", perms => mog("644"); ^--------^ -Error: Expected 3 arguments, received 1 for body 'mog' at tests/lint/014_num_args_body.x.cf:13:16 -Hint: The body 'mog' is defined at tests/lint/014_num_args_body.x.cf:1:12 +Error: Expected 3 arguments, received 1 for body 'mog' at tests/lint/013_num_args_body.x.cf:13:16 +Hint: The body 'mog' is defined at tests/lint/013_num_args_body.x.cf:1:12 create => "true", perms => mog("644", "root"); ^----------------^ -Error: Expected 3 arguments, received 2 for body 'mog' at tests/lint/014_num_args_body.x.cf:16:16 -Hint: The body 'mog' is defined at tests/lint/014_num_args_body.x.cf:1:12 +Error: Expected 3 arguments, received 2 for body 'mog' at tests/lint/013_num_args_body.x.cf:16:16 +Hint: The body 'mog' is defined at tests/lint/013_num_args_body.x.cf:1:12 create => "true", perms => mog("644", "root", "root", "root"); ^--------------------------------^ -Error: Expected 3 arguments, received 4 for body 'mog' at tests/lint/014_num_args_body.x.cf:22:16 -Hint: The body 'mog' is defined at tests/lint/014_num_args_body.x.cf:1:12 -FAIL: tests/lint/014_num_args_body.x.cf (3 errors) +Error: Expected 3 arguments, received 4 for body 'mog' at tests/lint/013_num_args_body.x.cf:22:16 +Hint: The body 'mog' is defined at tests/lint/013_num_args_body.x.cf:1:12 +FAIL: tests/lint/013_num_args_body.x.cf (3 errors) Failure, 3 errors in total. diff --git a/tests/lint/014_num_args_body.x.cf b/tests/lint/013_num_args_body.x.cf similarity index 100% rename from tests/lint/014_num_args_body.x.cf rename to tests/lint/013_num_args_body.x.cf diff --git a/tests/lint/014_num_args_bundle.expected.txt b/tests/lint/013_num_args_bundle.expected.txt similarity index 58% rename from tests/lint/014_num_args_bundle.expected.txt rename to tests/lint/013_num_args_bundle.expected.txt index 878cb86..cb277ff 100644 --- a/tests/lint/014_num_args_bundle.expected.txt +++ b/tests/lint/013_num_args_bundle.expected.txt @@ -2,19 +2,19 @@ "test1" usebundle => test(); ^----^ -Error: Expected 2 arguments, received 0 for bundle 'test' at tests/lint/014_num_args_bundle.x.cf:5:20 -Hint: The bundle 'test' is defined at tests/lint/014_num_args_bundle.x.cf:13:14 +Error: Expected 2 arguments, received 0 for bundle 'test' at tests/lint/013_num_args_bundle.x.cf:5:20 +Hint: The bundle 'test' is defined at tests/lint/013_num_args_bundle.x.cf:13:14 "test2" usebundle => test("a"); ^-------^ -Error: Expected 2 arguments, received 1 for bundle 'test' at tests/lint/014_num_args_bundle.x.cf:7:20 -Hint: The bundle 'test' is defined at tests/lint/014_num_args_bundle.x.cf:13:14 +Error: Expected 2 arguments, received 1 for bundle 'test' at tests/lint/013_num_args_bundle.x.cf:7:20 +Hint: The bundle 'test' is defined at tests/lint/013_num_args_bundle.x.cf:13:14 "test4" usebundle => test("a", "b", "c"); ^-----------------^ -Error: Expected 2 arguments, received 3 for bundle 'test' at tests/lint/014_num_args_bundle.x.cf:11:20 -Hint: The bundle 'test' is defined at tests/lint/014_num_args_bundle.x.cf:13:14 -FAIL: tests/lint/014_num_args_bundle.x.cf (3 errors) +Error: Expected 2 arguments, received 3 for bundle 'test' at tests/lint/013_num_args_bundle.x.cf:11:20 +Hint: The bundle 'test' is defined at tests/lint/013_num_args_bundle.x.cf:13:14 +FAIL: tests/lint/013_num_args_bundle.x.cf (3 errors) Failure, 3 errors in total. diff --git a/tests/lint/014_num_args_bundle.x.cf b/tests/lint/013_num_args_bundle.x.cf similarity index 100% rename from tests/lint/014_num_args_bundle.x.cf rename to tests/lint/013_num_args_bundle.x.cf diff --git a/tests/lint/014_num_args_bundle_body.cf b/tests/lint/013_num_args_bundle_body.cf similarity index 100% rename from tests/lint/014_num_args_bundle_body.cf rename to tests/lint/013_num_args_bundle_body.cf diff --git a/tests/lint/015_variadic_func_arg_count.cf b/tests/lint/014_variadic_func_arg_count.cf similarity index 100% rename from tests/lint/015_variadic_func_arg_count.cf rename to tests/lint/014_variadic_func_arg_count.cf diff --git a/tests/lint/015_variadic_func_arg_count.expected.txt b/tests/lint/014_variadic_func_arg_count.expected.txt similarity index 74% rename from tests/lint/015_variadic_func_arg_count.expected.txt rename to tests/lint/014_variadic_func_arg_count.expected.txt index 93a9aa6..774da92 100644 --- a/tests/lint/015_variadic_func_arg_count.expected.txt +++ b/tests/lint/014_variadic_func_arg_count.expected.txt @@ -2,11 +2,11 @@ "users3" slist => getusers("a", "b"); "users4" slist => getusers("a", "b", "c", "d"); ^--------------------------^ -Error: Expected 0-2 arguments, received 4 for function 'getusers' at tests/lint/015_variadic_func_arg_count.x.cf:7:23 +Error: Expected 0-2 arguments, received 4 for function 'getusers' at tests/lint/014_variadic_func_arg_count.x.cf:7:23 "file1" string => readfile("/tmp/tmp.txt"); "file2" string => readfile("/tmp/tmp.txt", "100", "/tmp/tmp2.txt"); ^----------------------------------------------^ -Error: Expected 1-2 arguments, received 3 for function 'readfile' at tests/lint/015_variadic_func_arg_count.x.cf:9:23 -FAIL: tests/lint/015_variadic_func_arg_count.x.cf (2 errors) +Error: Expected 1-2 arguments, received 3 for function 'readfile' at tests/lint/014_variadic_func_arg_count.x.cf:9:23 +FAIL: tests/lint/014_variadic_func_arg_count.x.cf (2 errors) Failure, 2 errors in total. diff --git a/tests/lint/015_variadic_func_arg_count.x.cf b/tests/lint/014_variadic_func_arg_count.x.cf similarity index 100% rename from tests/lint/015_variadic_func_arg_count.x.cf rename to tests/lint/014_variadic_func_arg_count.x.cf diff --git a/tests/lint/016_macro_multi_def_bundle.cf b/tests/lint/015_macro_multi_def_bundle.cf similarity index 100% rename from tests/lint/016_macro_multi_def_bundle.cf rename to tests/lint/015_macro_multi_def_bundle.cf diff --git a/tests/lint/015_macro_multi_def_bundle.expected.txt b/tests/lint/015_macro_multi_def_bundle.expected.txt new file mode 100644 index 0000000..f9c0890 --- /dev/null +++ b/tests/lint/015_macro_multi_def_bundle.expected.txt @@ -0,0 +1,14 @@ + + "test1" + usebundle => test(); + ^----^ +Error: Expected 1 or 2 arguments, received 0 for bundle 'test' at tests/lint/015_macro_multi_def_bundle.x.cf:20:20 +Hint: The bundle 'test' is defined at tests/lint/015_macro_multi_def_bundle.x.cf:2:14 and tests/lint/015_macro_multi_def_bundle.x.cf:8:14 + + "test2" + usebundle => test("hello", "world", "!"); + ^-------------------------^ +Error: Expected 1 or 2 arguments, received 3 for bundle 'test' at tests/lint/015_macro_multi_def_bundle.x.cf:23:20 +Hint: The bundle 'test' is defined at tests/lint/015_macro_multi_def_bundle.x.cf:2:14 and tests/lint/015_macro_multi_def_bundle.x.cf:8:14 +FAIL: tests/lint/015_macro_multi_def_bundle.x.cf (2 errors) +Failure, 2 errors in total. diff --git a/tests/lint/016_macro_multi_def_bundle.x.cf b/tests/lint/015_macro_multi_def_bundle.x.cf similarity index 100% rename from tests/lint/016_macro_multi_def_bundle.x.cf rename to tests/lint/015_macro_multi_def_bundle.x.cf diff --git a/tests/lint/017_half_promises.cf b/tests/lint/016_half_promises.cf similarity index 100% rename from tests/lint/017_half_promises.cf rename to tests/lint/016_half_promises.cf diff --git a/tests/lint/017_half_promises.expected.txt b/tests/lint/016_half_promises.expected.txt similarity index 66% rename from tests/lint/017_half_promises.expected.txt rename to tests/lint/016_half_promises.expected.txt index 412b429..be622ab 100644 --- a/tests/lint/017_half_promises.expected.txt +++ b/tests/lint/016_half_promises.expected.txt @@ -2,16 +2,16 @@ string => $(bar); string => $(bar); ^---------------^ -Error: Found promise attribute with no parent-promiser outside of a macro at tests/lint/017_half_promises.x.cf:6:7 +Error: Found promise attribute with no parent-promiser outside of a macro at tests/lint/016_half_promises.x.cf:6:7 string => $($(baz)); string => $($(baz)); ^------------------^ -Error: Multiple promise attributes with ending semicolon found inside macro 'minimum_version(3.18)' at tests/lint/017_half_promises.x.cf:9:7 +Error: Multiple promise attributes with ending semicolon found inside macro 'minimum_version(3.18)' at tests/lint/016_half_promises.x.cf:9:7 # comment string => $($(baz)); ^------------------^ -Error: Multiple promise attributes with ending semicolon found inside macro 'else' at tests/lint/017_half_promises.x.cf:26:7 -FAIL: tests/lint/017_half_promises.x.cf (3 errors) +Error: Multiple promise attributes with ending semicolon found inside macro 'else' at tests/lint/016_half_promises.x.cf:26:7 +FAIL: tests/lint/016_half_promises.x.cf (3 errors) Failure, 3 errors in total. diff --git a/tests/lint/017_half_promises.x.cf b/tests/lint/016_half_promises.x.cf similarity index 100% rename from tests/lint/017_half_promises.x.cf rename to tests/lint/016_half_promises.x.cf diff --git a/tests/lint/016_macro_multi_def_bundle.expected.txt b/tests/lint/016_macro_multi_def_bundle.expected.txt deleted file mode 100644 index ac69174..0000000 --- a/tests/lint/016_macro_multi_def_bundle.expected.txt +++ /dev/null @@ -1,14 +0,0 @@ - - "test1" - usebundle => test(); - ^----^ -Error: Expected 1 or 2 arguments, received 0 for bundle 'test' at tests/lint/016_macro_multi_def_bundle.x.cf:20:20 -Hint: The bundle 'test' is defined at tests/lint/016_macro_multi_def_bundle.x.cf:2:14 and tests/lint/016_macro_multi_def_bundle.x.cf:8:14 - - "test2" - usebundle => test("hello", "world", "!"); - ^-------------------------^ -Error: Expected 1 or 2 arguments, received 3 for bundle 'test' at tests/lint/016_macro_multi_def_bundle.x.cf:23:20 -Hint: The bundle 'test' is defined at tests/lint/016_macro_multi_def_bundle.x.cf:2:14 and tests/lint/016_macro_multi_def_bundle.x.cf:8:14 -FAIL: tests/lint/016_macro_multi_def_bundle.x.cf (2 errors) -Failure, 2 errors in total. diff --git a/tests/lint/018_implies_body.cf b/tests/lint/017_implies_body.cf similarity index 100% rename from tests/lint/018_implies_body.cf rename to tests/lint/017_implies_body.cf diff --git a/tests/lint/018_implies_body.expected.txt b/tests/lint/017_implies_body.expected.txt similarity index 71% rename from tests/lint/018_implies_body.expected.txt rename to tests/lint/017_implies_body.expected.txt index 9e42486..8b28a6b 100644 --- a/tests/lint/018_implies_body.expected.txt +++ b/tests/lint/017_implies_body.expected.txt @@ -2,37 +2,37 @@ "/tmp/test1" copy_from => helper("oops"); ^----^ -Error: Expected a body but 'helper' is a bundle at tests/lint/018_implies_body.x.cf:17:20 +Error: Expected a body but 'helper' is a bundle at tests/lint/017_implies_body.x.cf:17:20 "/tmp/test2" copy_from => unknown_name("oops"); ^----------^ -Error: Call to unknown body 'unknown_name' at tests/lint/018_implies_body.x.cf:19:20 +Error: Call to unknown body 'unknown_name' at tests/lint/017_implies_body.x.cf:19:20 "/tmp/test3" copy_from => mycopy("/src"); ^------------^ -Error: Expected 2 arguments, received 1 for body 'mycopy' at tests/lint/018_implies_body.x.cf:21:20 -Hint: The body 'mycopy' is defined at tests/lint/018_implies_body.x.cf:1:16 +Error: Expected 2 arguments, received 1 for body 'mycopy' at tests/lint/017_implies_body.x.cf:21:20 +Hint: The body 'mycopy' is defined at tests/lint/017_implies_body.x.cf:1:16 "/tmp/test4" copy_from => readfile("/etc/file", "100"); ^------^ -Error: Expected a body but 'readfile' is a built-in function at tests/lint/018_implies_body.x.cf:23:20 +Error: Expected a body but 'readfile' is a built-in function at tests/lint/017_implies_body.x.cf:23:20 "test5" usebundle => mycopy("/src", "host"); ^----^ -Error: Expected a bundle but 'mycopy' is a body at tests/lint/018_implies_body.x.cf:26:20 +Error: Expected a bundle but 'mycopy' is a body at tests/lint/017_implies_body.x.cf:26:20 "test6" usebundle => readfile("/etc/file", "100"); ^------^ -Error: Expected a bundle but 'readfile' is a built-in function at tests/lint/018_implies_body.x.cf:28:20 +Error: Expected a bundle but 'readfile' is a built-in function at tests/lint/017_implies_body.x.cf:28:20 "test7" usebundle => unknown_bundle("oops"); ^------------^ -Error: Call to unknown bundle 'unknown_bundle' at tests/lint/018_implies_body.x.cf:30:20 -FAIL: tests/lint/018_implies_body.x.cf (7 errors) +Error: Call to unknown bundle 'unknown_bundle' at tests/lint/017_implies_body.x.cf:30:20 +FAIL: tests/lint/017_implies_body.x.cf (7 errors) Failure, 7 errors in total. diff --git a/tests/lint/018_implies_body.x.cf b/tests/lint/017_implies_body.x.cf similarity index 100% rename from tests/lint/018_implies_body.x.cf rename to tests/lint/017_implies_body.x.cf diff --git a/tests/lint/019_nested_calls.cf b/tests/lint/018_nested_calls.cf similarity index 100% rename from tests/lint/019_nested_calls.cf rename to tests/lint/018_nested_calls.cf diff --git a/tests/lint/019_nested_calls.expected.txt b/tests/lint/018_nested_calls.expected.txt similarity index 70% rename from tests/lint/019_nested_calls.expected.txt rename to tests/lint/018_nested_calls.expected.txt index dbe712f..65be3a1 100644 --- a/tests/lint/019_nested_calls.expected.txt +++ b/tests/lint/018_nested_calls.expected.txt @@ -2,21 +2,21 @@ "test1" usebundle => helper(helper("nested-bundle")); ^----^ -Error: Expected a built-in function but 'helper' is a bundle at tests/lint/019_nested_calls.x.cf:16:27 +Error: Expected a built-in function but 'helper' is a bundle at tests/lint/018_nested_calls.x.cf:16:27 "test2" usebundle => helper(mycopy("nested-body")); ^----^ -Error: Expected a built-in function but 'mycopy' is a body at tests/lint/019_nested_calls.x.cf:18:27 +Error: Expected a built-in function but 'mycopy' is a body at tests/lint/018_nested_calls.x.cf:18:27 "test3" usebundle => helper(unknown_name("oops")); ^----------^ -Error: Call to unknown function 'unknown_name' at tests/lint/019_nested_calls.x.cf:20:27 +Error: Call to unknown function 'unknown_name' at tests/lint/018_nested_calls.x.cf:20:27 "/tmp/test4" copy_from => mycopy(unknown_name("oops")); ^----------^ -Error: Call to unknown function 'unknown_name' at tests/lint/019_nested_calls.x.cf:23:27 -FAIL: tests/lint/019_nested_calls.x.cf (4 errors) +Error: Call to unknown function 'unknown_name' at tests/lint/018_nested_calls.x.cf:23:27 +FAIL: tests/lint/018_nested_calls.x.cf (4 errors) Failure, 4 errors in total. diff --git a/tests/lint/019_nested_calls.x.cf b/tests/lint/018_nested_calls.x.cf similarity index 100% rename from tests/lint/019_nested_calls.x.cf rename to tests/lint/018_nested_calls.x.cf diff --git a/tests/lint/020_bundle_name_expansion.cf b/tests/lint/019_bundle_name_expansion.cf similarity index 100% rename from tests/lint/020_bundle_name_expansion.cf rename to tests/lint/019_bundle_name_expansion.cf From 00e6a8f7190c91a31854fcc756421f94befb8d8a Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 15:13:39 +0200 Subject: [PATCH 5/6] tests: Expanded linting tests for deprecations to cover str attribute in vars Co-authored-by: Claude Opus 4.7 (1M context) Signed-off-by: Ole Herman Schumacher Elgesem --- tests/lint/002_deprecations.expected.txt | 11 ++++++++--- tests/lint/002_deprecations.x.cf | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tests/lint/002_deprecations.expected.txt b/tests/lint/002_deprecations.expected.txt index 7befc97..06945fb 100644 --- a/tests/lint/002_deprecations.expected.txt +++ b/tests/lint/002_deprecations.expected.txt @@ -4,9 +4,14 @@ ^-------^ Deprecation: Promise type 'defaults' is deprecated at tests/lint/002_deprecations.x.cf:3:3 + vars: + "x" str => "value"; + ^-^ +Deprecation: Use 'string' instead of 'str' at tests/lint/002_deprecations.x.cf:6:9 + "Hello, CFEngine" ifvarclass => "cfengine"; ^--------^ -Deprecation: Use 'if' instead of 'ifvarclass' at tests/lint/002_deprecations.x.cf:7:7 -FAIL: tests/lint/002_deprecations.x.cf (2 errors) -Failure, 2 errors in total. +Deprecation: Use 'if' instead of 'ifvarclass' at tests/lint/002_deprecations.x.cf:9:7 +FAIL: tests/lint/002_deprecations.x.cf (3 errors) +Failure, 3 errors in total. diff --git a/tests/lint/002_deprecations.x.cf b/tests/lint/002_deprecations.x.cf index d915012..2944877 100644 --- a/tests/lint/002_deprecations.x.cf +++ b/tests/lint/002_deprecations.x.cf @@ -2,6 +2,8 @@ bundle agent main { defaults: "x" string => "value"; + vars: + "x" str => "value"; reports: "Hello, CFEngine" ifvarclass => "cfengine"; From 2dbf9f84252f7ca686deb822f4e12c47f53f7cd5 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Wed, 6 May 2026 15:22:29 +0200 Subject: [PATCH 6/6] tests: Expanded linting test for lowercase name convention Co-authored-by: Claude Opus 4.7 (1M context) Signed-off-by: Ole Herman Schumacher Elgesem --- tests/lint/003_bundle_name_lowercase.cf | 5 ----- .../lint/003_bundle_name_lowercase.expected.txt | 6 ------ tests/lint/003_bundle_name_lowercase.x.cf | 5 ----- tests/lint/003_name_lowercase.cf | 16 ++++++++++++++++ tests/lint/003_name_lowercase.expected.txt | 16 ++++++++++++++++ tests/lint/003_name_lowercase.x.cf | 16 ++++++++++++++++ 6 files changed, 48 insertions(+), 16 deletions(-) delete mode 100644 tests/lint/003_bundle_name_lowercase.cf delete mode 100644 tests/lint/003_bundle_name_lowercase.expected.txt delete mode 100644 tests/lint/003_bundle_name_lowercase.x.cf create mode 100644 tests/lint/003_name_lowercase.cf create mode 100644 tests/lint/003_name_lowercase.expected.txt create mode 100644 tests/lint/003_name_lowercase.x.cf diff --git a/tests/lint/003_bundle_name_lowercase.cf b/tests/lint/003_bundle_name_lowercase.cf deleted file mode 100644 index 2f876b1..0000000 --- a/tests/lint/003_bundle_name_lowercase.cf +++ /dev/null @@ -1,5 +0,0 @@ -bundle agent my_bundle -{ - reports: - "Hello"; -} diff --git a/tests/lint/003_bundle_name_lowercase.expected.txt b/tests/lint/003_bundle_name_lowercase.expected.txt deleted file mode 100644 index 8a01374..0000000 --- a/tests/lint/003_bundle_name_lowercase.expected.txt +++ /dev/null @@ -1,6 +0,0 @@ - -bundle agent MyBundle - ^------^ -Convention: Bundle name should be lowercase at tests/lint/003_bundle_name_lowercase.x.cf:1:14 -FAIL: tests/lint/003_bundle_name_lowercase.x.cf (1 error) -Failure, 1 error in total. diff --git a/tests/lint/003_bundle_name_lowercase.x.cf b/tests/lint/003_bundle_name_lowercase.x.cf deleted file mode 100644 index 46d3776..0000000 --- a/tests/lint/003_bundle_name_lowercase.x.cf +++ /dev/null @@ -1,5 +0,0 @@ -bundle agent MyBundle -{ - reports: - "Hello"; -} diff --git a/tests/lint/003_name_lowercase.cf b/tests/lint/003_name_lowercase.cf new file mode 100644 index 0000000..76b6c32 --- /dev/null +++ b/tests/lint/003_name_lowercase.cf @@ -0,0 +1,16 @@ +bundle agent my_bundle +{ + reports: + "Hello"; +} + +body perms my_body +{ + owners => { "root" }; +} + +promise agent my_promise_type +{ + path => "/bin/true"; + interpreter => "/bin/bash"; +} diff --git a/tests/lint/003_name_lowercase.expected.txt b/tests/lint/003_name_lowercase.expected.txt new file mode 100644 index 0000000..dda85b7 --- /dev/null +++ b/tests/lint/003_name_lowercase.expected.txt @@ -0,0 +1,16 @@ + +bundle agent MyBundle + ^------^ +Convention: Bundle name should be lowercase at tests/lint/003_name_lowercase.x.cf:1:14 + + +body perms MyBody + ^----^ +Convention: Body name should be lowercase at tests/lint/003_name_lowercase.x.cf:7:12 + + +promise agent MyPromiseType + ^-----------^ +Convention: Promise type should be lowercase at tests/lint/003_name_lowercase.x.cf:12:15 +FAIL: tests/lint/003_name_lowercase.x.cf (3 errors) +Failure, 3 errors in total. diff --git a/tests/lint/003_name_lowercase.x.cf b/tests/lint/003_name_lowercase.x.cf new file mode 100644 index 0000000..e74fbf2 --- /dev/null +++ b/tests/lint/003_name_lowercase.x.cf @@ -0,0 +1,16 @@ +bundle agent MyBundle +{ + reports: + "Hello"; +} + +body perms MyBody +{ + owners => { "root" }; +} + +promise agent MyPromiseType +{ + path => "/bin/true"; + interpreter => "/bin/bash"; +}