MarketSquare / robotframework-robocop

Tool for static code analysis of Robot Framework language
Apache License 2.0
187 stars 38 forks source link

[Bug] The output file keeps empty when it is only specified in the configfile. #1132

Open cz-lucas opened 3 weeks ago

cz-lucas commented 3 weeks ago

What happened?

Run robocop with the following pyproject.toml file:

[tool.robocop]
reports = [
    "rules_by_id",
    "scan_timer"
]
filetypes = [".resource", ".robot"]
threshold = "I"
format = "{source}:{line}:{col} [{severity}] {rule_id} {desc} (name)"
output = "../results/robocop.log"

It also won't work with the example from the documentation.

What command/code did you try to run?

python -m robocop . and robocop .`

What is the full error message?

The file where the output should be written in is created but empty. Everything is printed to the console. If I run robocop with the ---config results/robocop.log everything works as expected.

What did you expect to happen instead?

The output is written to the file that is specified with the output in the pyproject.toml.

Operating System

Windows 10

Robocop version

5.5.4 and 5.5.0

bhirsz commented 1 week ago

Ugh, thats quite important bug. I will see if we have some tests for it and why it was not catched. Thanks for the report.

Our output handling is not the best - there is idea to rewrite it a bit so it will also solve this case hopefully. I will make sure to add tests for it