In general, when the prompter asks you to fix the implementation, this means that they have adjusted the tests already and they want you to fix the implementation. Typically you should not touch the tests in this case, unless there is something obviously wrong in them, like a typo. The first step to identify what is necessary should be to run the tests and see which ones are failing.
In general, the main command to run for testing is:
make checkThis will run all the test suites.
This project uses uv.
That means that you should not run python, python3, pip, pip3 directly.
Instead, run the appropriate uv command to ensure we're using the right python and the right dependencies.
When fixing issues, these are usually the files to look at:
- The implementation of
cfengine formatis insrc/cfengine_cli/format.py. - The implementation of
cfengine lintis insrc/cfengine_cli/lint.py.
When working on the formatter or the linter, it is often useful to look at the syntax tree of the policy file.
There is a dev subcommand for this:
uv run cfengine dev syntax-tree tests/lint/001_hello_world.cfThe command above prints the syntax tree for tests/lint/001_hello_world.cf to the terminal (standard output).
As mentioned above, the make check command runs all the tests.
We have different suites:
- Unit tests in
tests/unittest individual python functions. - Formatting tests in
tests/formattest the formatter (cfengine format). - Linting tests in
tests/linttest the linter. - Shell tests in
tests/shelltests various subcommands and the tool as a whole in an end-to-end fashion.