Skip to content

Commit f7df415

Browse files
authored
Merge pull request #35 from olehermanse/main
cfengine lint: Fixed traceback in linting code
2 parents 6406443 + 073f447 commit f7df415

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,23 @@ cfengine format
4747
cfengine lint
4848
```
4949

50+
You can also specify filenames or folders;
51+
52+
```bash
53+
cfengine lint main.cf
54+
```
55+
56+
When it finds a mistake, it points out where the problem is like this;
57+
58+
```
59+
"Hello, CFEngine"
60+
ifvarclass => "cfengine";
61+
^--------^
62+
Deprecation: Use 'if' instead of 'ifvarclass' at main.cf:5:7
63+
FAIL: main.cf (1 errors)
64+
Failure, 1 errors in total.
65+
```
66+
5067
Note that since we use a different parser than `cf-agent` / `cf-promises`, they are not 100% in sync.
5168
`cf-agent` could point out something as a syntax error, while `cfengine lint` does not and vice versa.
5269
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.

src/cfengine_cli/lint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,4 +396,4 @@ def lint_single_arg(arg, strict=True):
396396
return lint_folder(arg, strict)
397397
assert os.path.isfile(arg)
398398

399-
return lint_single_file(arg, strict)
399+
return lint_single_file(arg, strict=strict)

0 commit comments

Comments
 (0)