Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Project-level rules don't show up in IDE #1108

Open
Lakitna opened this issue Aug 22, 2024 · 3 comments
Open

[Bug] Project-level rules don't show up in IDE #1108

Lakitna opened this issue Aug 22, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@Lakitna
Copy link
Contributor

Lakitna commented Aug 22, 2024

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 newer run_project_checks is not executed by the language servers.

If you run Robcop from the command line, the run_checks function ensures that both run_check and run_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

@Lakitna Lakitna added the bug Something isn't working label Aug 22, 2024
@bhirsz
Copy link
Member

bhirsz commented Aug 25, 2024

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.

@Lakitna
Copy link
Contributor Author

Lakitna commented Nov 7, 2024

With the whole 6.0.0/robotidy migration thing. Maybe this should be solved in the new architecture?

@bhirsz
Copy link
Member

bhirsz commented Nov 7, 2024

Yeah, I want to try it - it's already possible to do it in current Robocop but I would prefer to implement it in 6.0 (let's call it robocop2 for now) as I will be doing a lot of other breaking changes, updates to how plugins use our tool etc so it can be done together

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants