.robocop not picked up when using API
See original GitHub issueWhen using the API as:
import robocop
from robocop.config import Config
from robocop.utils import issues_to_lsp_diagnostic
config = Config(root=project_root)
robocop_runner = robocop.Robocop(config=config)
robocop_runner.reload_config()
issues = robocop_runner.run_check(ast_model, filename, source)
diag_issues = issues_to_lsp_diagnostic(issues)
return diag_issues
The .robocop file is not being loaded based on the project_root.
I debugged a bit and it seems like load_default_config_file is never called. I tried to manually call: config.parse_opts([]), right after creating the Config and it seems to pick things up on the debugger, but I still couldn’t get it to ignore what I expected.
I tested with a file with:
*** Test Cases ***
Test
Fail
and a .robocop file with:
--exclude missing-doc-testcase
--include missing-doc-suite
But the missing doc in the testcase is still reported.
So, I’m waiting on some pointers on what I’m doing wrong here…
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
User guide - Robocop 2.6.0
This is short overview of how to use Robocop together with links to more extensive documentation. You can run lint scan on Robot...
Read more >MarketSquare/robotframework-robocop - GitHub
Tool for static code analysis of Robot Framework language - GitHub - MarketSquare/robotframework-robocop: Tool for static code analysis of Robot Framework ...
Read more >RoboCon 2021 - 3.03 NEW PARSING API FOR ROBOT ...
What is the connection between fast development of recent RF versions and new parsing API ? It makes extending Robot Framework code a...
Read more >API Errors - Oracle Help Center
Learn about the common errors returned by all the services for Oracle Cloud Infrastructure.
Read more >How to Debug Web API Problems in 4 Steps - Kill All Defects
This article is a step-by-step diagnostic guide for working through common issues with web services. The article assumes that you have a web ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Configuration (when calling parse_opts and
.robocopexisting) is loaded correctly. The problem is that we’re ‘filtering out’ some if the issues - based on config - when reporting the issues. Since we’re not reporting the issues in self.run method it will leave everything (instead of reporting them we return list of issues, that is converted to lsp diagnostic later on). I will rearrange our architecture.Also if the root is not the Path it will throw an error (I saw you made workaround for that). I will fix that as well.
For argument parsing issues I had to create workaround - because argparse that we’re using in Robocp always returns SystemExit. After my changes, if you’re using Robocop API and you have invalid configuration it should return “InvalidArgumentError” exception (found in robocop.exceptions).