Robot Framework Robocop
Robocop is a static code analysis tool (linter) and code formatter specifically designed for Robot Framework. It uses the official Robot Framework parsing API to analyze files and enforce code quality standards and formatting. Currently at version 8.2.5, the library maintains an active development status with regular minor/patch releases and impactful major version updates approximately once a year.
Warnings
- breaking Version 8.0.0 dropped support for Python 3.9 and Robot Framework 4. Ensure your environment meets the new requirements (Python 3.10+, Robot Framework 5.0+).
- breaking In version 8.0.0, the `deprecated-statement` rule was split and removed, and the `ReplaceReturns` and `AddMissingEnd` formatters were deprecated/removed. Your configurations might need updating.
- gotcha Major version updates (e.g., to 8.0.0) can break compatibility with IDE plugins like RobotCode due to internal API changes. Check for updated plugin versions if you encounter issues.
- gotcha Robocop supports multiple configuration methods (`.robocop` file, `pyproject.toml`, `--argumentfile` CLI option). Understand the precedence rules to avoid unexpected behavior.
Install
-
pip install -U robotframework-robocop -
pip install -U robotframework-robocop[mcp]
Imports
- VisitorChecker
from robocop.checkers import VisitorChecker
Quickstart
# To lint Robot Framework files in the current directory: robocop check # To format Robot Framework files in the current directory: robocop format # To lint a specific file: robocop check path/to/your_file.robot # To format a specific file: robocop format path/to/your_file.robot # For help with available commands and options: robocop -h