From c51d6b64f63a1e0eb63832a178d8ef637ea21454 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Mon, 30 Mar 2026 17:55:22 +0200 Subject: [PATCH 1/2] cfengine lint: Fixed traceback in linting code Signed-off-by: Ole Herman Schumacher Elgesem --- src/cfengine_cli/lint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cfengine_cli/lint.py b/src/cfengine_cli/lint.py index a686f69..ee133f2 100644 --- a/src/cfengine_cli/lint.py +++ b/src/cfengine_cli/lint.py @@ -396,4 +396,4 @@ def lint_single_arg(arg, strict=True): return lint_folder(arg, strict) assert os.path.isfile(arg) - return lint_single_file(arg, strict) + return lint_single_file(arg, strict=strict) From 073f447685051591408d793a14a3fdb8cdc1ade7 Mon Sep 17 00:00:00 2001 From: Ole Herman Schumacher Elgesem Date: Mon, 30 Mar 2026 18:01:33 +0200 Subject: [PATCH 2/2] Added example of cfengine lint output to README Signed-off-by: Ole Herman Schumacher Elgesem --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index a019230..2b80121 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,23 @@ cfengine format cfengine lint ``` +You can also specify filenames or folders; + +```bash +cfengine lint main.cf +``` + +When it finds a mistake, it points out where the problem is like this; + +``` + "Hello, CFEngine" + ifvarclass => "cfengine"; + ^--------^ +Deprecation: Use 'if' instead of 'ifvarclass' at main.cf:5:7 +FAIL: main.cf (1 errors) +Failure, 1 errors in total. +``` + Note that since we use a different parser than `cf-agent` / `cf-promises`, they are not 100% in sync. `cf-agent` could point out something as a syntax error, while `cfengine lint` does not and vice versa. We aim to make the tree-sitter parser (used in this tool) more strict in general, so that when `cfengine lint` is happy with your policy, `cf-agent` will also accept it.