Open Lakitna opened 2 months ago
It wasn't entirely because of the performance reason - usually project checks are disabled by default so it would not affect users if I were to implement it in old method. The main reason behind current implementation is that I wanted to ensure that we run project checks last - after scanning all other files. While scanning other files we gather statistics/data (it's done whenever we call something with run_check) and then run_project_checks
scans accumulated data and optionally finds issues.
One solution would be simply adding run_project_checks
to both plugins source code. But it will be far from ideal because "project check" will transform into "scan this file with normal checks and then scan with project checks" - since those plugins scan each file separetely. Current only existing project check (unused keyword) will still work because it's in alpha state and only finds private / suite keywords but it may not work in the future after update.
I need to think about it, possibly other option of calling robocop on the project level in those plugins would be best. It could be also more optimal since plugins have access to project 'root' while robocop usually tries to guess it.
What happened?
When using Robocop in an IDE, the new
unused-keyword
rule does not show up.I dug a bit deeper, this is caused by how both robocorp/robotframework-lsp and robotcodedev/robotcode call Robocop. The relevant lines are:
Both language servers call
run_check
. Because of this, the newerrun_project_checks
is not executed by the language servers.If you run Robcop from the command line, the
run_checks
function ensures that bothrun_check
andrun_poject_checks
are called.What command/code did you try to run?
I used VSCode with robocorp/robotframework-lsp, then ran Robocop through the language server.
What is the full error message?
N/A. The rule is not executed
What did you expect to happen instead?
I expect the output in my IDE to be the same as the output in the CLI. Otherwise, the usefulness of project-level rules is greatly diminished.
I recognize that this was probably a deliberate choice made for performance reasons. I'm making this issue in part to discuss where this should be fixed. I have not found this issue in either of the language server repositories.
Operating System
Windows
Robocop version
5.4.0