Skip to main content

Robocop

Unit tests Codecov PyPI Python versions License Downloads



Introduction

Robocop is a tool that performs static code analysis and formatting of Robot Framework code.

It uses official Robot Framework parsing API to parse files and runs a number of checks, looking for potential errors or violations to code quality standards (commonly referred to as linting issues).

Hosted on GitHub.

Documentation

Full documentation is available at https://robocop.dev. :open_book:

The most common questions with answers can be found at the bottom ⬇ of this README file.

Requirements

Python 3.10+ :snake: and Robot Framework 5.0+ :robot:.

Installation

You can install the latest version of Robocop simply by running:

pip install -U robotframework-robocop

Usage

Robocop runs by default from the current directory, and it discovers supported files recursively. To lint the files, you can run:

robocop check

To format the files, you can run:

robocop format

All command line options can be displayed in a help message by executing:

robocop -h

Example Output

Executing command:

robocop check --reports rules_by_error_type test.robot

Will result in the following output:

test.robot:17:1 SPC22 Not enough whitespace after 'Test Teardown' setting
    |
 15 |
 16 | Test Setup Keyword
 17 | Test Teardown Keyword2
    | ^ SPC22
 18 | Testtimeout 1min
 19 | Documentation this is doc
    |

test.robot:28:1 SPC14 Variable in Variables section is not left aligned
   |
 1 | *** Variables ***
 2 | ${VAR} 1
 3 |  ${VAR}  1
   | ^ SPC14
 4 |   ${VAR}  1
 5 | VALUE  1

Found 2 issues: 2 ERRORs, 0 WARNINGs, 0 INFO.

MCP Server

Robocop provides an MCP (Model Context Protocol) server that allows AI assistants like Claude and GitHub Copilot to lint and format Robot Framework code directly.

Install with MCP support:

pip install robotframework-robocop[mcp]

Run the server:

robocop-mcp

Full documentation: MCP Server

Values

Original RoboCop - a fictional cybernetic police officer - was the following three prime directives which also drive the progress of Robocop linter:

First Directive: Serve the public trust

Which lies behind the creation of the project - to serve developers and testers as a tool to build applications they can trust.

Second Directive: Protect the innocent

The innocent testers and developers have no intention of producing ugly code, but sometimes, you know, it just happens, so Robocop is there to protect them.

Third Directive: Uphold the law

Following the coding guidelines established in the project are something crucial to keep the code clean, readable and understandable by others, and Robocop can help to uphold the law.

FAQ

Can I integrate Robocop with my code editor (IDE)?

Yes, Robocop integrates nicely with popular IDEs like PyCharm or VSCode thanks to the RobotCode plugin. Read a simple manual (README) in that project to figure out how to install and use it.

Can I load configuration from a file?

Yes, you can use toml-based configuration files:

pyproject.toml file robocop.toml file robot.toml file

Example configuration file:

[tool.robocop]
exclude = ["deprecated.robot"]

[tool.robocop.lint]
select = [
  "rulename",
  "ruleid"
]
configure = [
    "line-too-long.line_length=110"
]

[tool.robocop.format]
select = ["NormalizeNewLines"]
configure = [
    "NormalizeNewLines.flatten_lines=True"
]

Multiple configuration files are supported. However, global-like options such as --verbose or --reports are only loaded from a top configuration file. Read more in configuration.

I use different coding standards. Can I configure rules so that they fit my needs?

Yes, some rules and formatters are configurable. You can find the configuration details in the documentation or by running:

robocop docs rule_name_or_id
robocop docs formatter_name

Configuring is done by using -c / --configure command line option followed by pattern <name>.<param_name>=<value> where:

  • <name> can either be rule name or its id, or formatter name
  • <param_name> is a public name of the parameter
  • <value> is a desired value of the parameter

For example:

robocop check --configure line-too-long.line_length=140

Each rule's severity can also be overwritten. Possible values are e/error, w/warning or i/info and are case-insensitive. Example:

robocop check -c too-long-test-case.severity=e

If there are special cases in your code that violate the rules, you can also exclude them in the source code.

Example:

Keyword with lowercased name  # robocop: off

More about it in our documentation.

Can I define custom rules?

Yes, you can define and include custom rules using --custom-rules command line option by providing a path to a file containing your rule(s):

robocop --custom-rules my/own/rule.py --custom-rules external_rules.py

If you feel that your rule is very helpful and should be included in Robocop permanently, you can always share your solution by submitting a pull request. You can also share your idea by creating an issue.

More about custom rules with code examples in our documentation.

Can I use Robocop in continuous integration (CI) tools?

Yes, Robocop is able to produce different kinds of reports that are supported by most popular platforms such as GitHub, Gitlab, Sonar Qube, etc. Read more in integrations.


Excuse me, I have to go. Somewhere there is a crime happening. - Robocop

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_robocop-8.8.0.tar.gz (986.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_robocop-8.8.0-py3-none-any.whl (328.9 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_robocop-8.8.0.tar.gz.

File metadata

  • Download URL: robotframework_robocop-8.8.0.tar.gz
  • Upload date:
  • Size: 986.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for robotframework_robocop-8.8.0.tar.gz
Algorithm Hash digest
SHA256 8da173558587e0d0b3f51ac0bd9d333414a7c28565563d4a93d829f10652dedb
MD5 59e45b5d57c065537220789bb30c88d1
BLAKE2b-256 831734141292d0d9d552d2d2bc7107a9c66111d10b932cd594fcaa3dfaf44a72

See more details on using hashes here.

File details

Details for the file robotframework_robocop-8.8.0-py3-none-any.whl.

File metadata

  • Download URL: robotframework_robocop-8.8.0-py3-none-any.whl
  • Upload date:
  • Size: 328.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for robotframework_robocop-8.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 06ab647064e9f2ceeb3a956e9aa7af9488b629f546c4ac0a721228626199a90d
MD5 f176fb77260dc8795ff5628f3957262e
BLAKE2b-256 e6aaa5b2dafdf44a354c9bd0ad595d5f56ea546f666346724161f6b443c81b92

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

8.8.0 This release

2 files

8.7.0

2 files

8.6.0

2 files

8.5.0

2 files

8.4.1

2 files

8.4.0

2 files

8.3.2

2 files

8.3.1

2 files

8.3.0

2 files

8.2.11

2 files

8.2.10

2 files

8.2.9

2 files

8.2.8

2 files

8.2.7

2 files

8.2.6

2 files

8.2.5

2 files

8.2.4

2 files

8.2.3

2 files

8.2.2

2 files

8.2.1

2 files

8.2.0

2 files

8.1.1

2 files

8.1.0

2 files

8.0.0

2 files

7.2.0

2 files

7.1.0

2 files

7.0.0

2 files

6.13.0

2 files

6.12.0

2 files

6.11.0

2 files

6.10.1

2 files

6.10.0

2 files

6.9.2

2 files

6.9.1

2 files

6.9.0

2 files

6.8.3

2 files

6.8.2

2 files

6.8.1

2 files

6.8.0

2 files

6.7.2

2 files

6.7.1

2 files

6.7.0

2 files

6.6.1

2 files

6.6.0

2 files

6.5.2

2 files

6.5.1

2 files

6.5.0

2 files

6.4.0

2 files

6.3.0

2 files

6.2.0

2 files

6.1.1

2 files

6.1.0

2 files

6.0.4

2 files

6.0.3

2 files

6.0.2

2 files

6.0.1

2 files

6.0.0

2 files

5.9.0

2 files

5.8.1

2 files

5.8.0

2 files

5.7.0

2 files

5.6.0

2 files

5.5.0

2 files

5.4.0

2 files

5.3.0

2 files

5.2.0

2 files

5.1.0

2 files

5.0.4

2 files

5.0.3

2 files

5.0.2

2 files

5.0.1

2 files

5.0.0

2 files

4.2.2

2 files

4.2.1

2 files

4.2.0

2 files

4.1.1

2 files

4.1.0

2 files

4.0.1

2 files

4.0.0

2 files

3.2.1

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.8.1

2 files

2.8.0

2 files

2.7.0

2 files

2.6.0

2 files

2.5.0

2 files

2.4.0

2 files

2.3.0

2 files

2.2.0

2 files

2.1.0

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.12.0

2 files

1.11.2

2 files

1.11.1

2 files

1.11.0

2 files

1.10.0

2 files

1.9.0

2 files

1.8.1

2 files

1.8.0

2 files

1.7.1

2 files

1.7.0

2 files

1.6.1

2 files

1.6.0

2 files

1.5.0

2 files

1.4.1

2 files

1.4.0

2 files

1.3.2

2 files

1.3.1

2 files

1.3.0

2 files

1.2.1

2 files

1.2.0

2 files

1.1.0

2 files

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page