Skip to content

auto_keywords=None suppresses 'library contains no keywords' warning #5421

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

JFoederer
Copy link
Contributor

@JFoederer JFoederer commented May 4, 2025

Update to the @library decorator that accepts @library(auto_keywords=None) to suppress the (very prominent) 'contains no keywords' warning as shown in this example.

image

Other than suppressing the warning it behaves identical to @library(auto_keywords=False)

@JFoederer
Copy link
Contributor Author

Hi @pekkaklarck, can you please review this PR?

I basically have 2 questions:

  • What is your opinion on suppressing this warning?
  • Is the low-impact way of 'abusing' the existing auto_keywords option the preferred way?

The alternative would be to have a separate option, but I feel this might be overkill for such a niche option.

@pekkaklarck
Copy link
Member

pekkaklarck commented May 7, 2025

auto_keywords=None is both clever and hacky. It's certainly better than a separate parameter for this niche use case. Related to that, could you explain your use case for this behavior? Why would you have a library without any keywords? Instead of explaining that here, you could submit an issue because we'd anyway need one for tracking purposes.

Notice also that there's another way to avoid this warning: adding a listener to the library. Listeners don't need to have any listener methods and nowadays don't even need to ROBOT_LISTENER_API_VERSION attribute, so you could probably use just @library(listener=object()).

@JFoederer
Copy link
Contributor Author

I agree it is hacky, but to be honest, turning it into a fake listener sounds even more hacky than auto_keywords=None. It would do the trick, though. But I must add that I wouldn't have thought of this option, even after reading the documentation and seeing the source code. I hadn't realised that empty unregistered listeners would work.

I will submit the issue and then we have three options: accept it as-is, reject it and keep using the listener or find a pretty solution.

@JFoederer
Copy link
Contributor Author

While writing down the issue I dropped one of the two use cases. Reflecting on it made me realise I didn't need those files loaded in Robot. Having the objects sufficed. The other one is described in the issue I linked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants