robotframework-robocop


Namerobotframework-robocop JSON
Version 6.5.2 PyPI version JSON
download
home_pageNone
SummaryStatic code analysis tool (linter) and code formatter for Robot Framework
upload_time2025-08-01 15:14:14
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseNone
keywords automation formatter formatting linter qa robotframework testautomation testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![Unit tests](https://github.com/MarketSquare/robotframework-robocop/actions/workflows/tests.yml/badge.svg)](https://github.com/MarketSquare/robotframework-robocop/actions/workflows/unit-tests.yml "GitHub Workflow Unit Tests Status")
![Codecov](https://img.shields.io/codecov/c/github/MarketSquare/robotframework-robocop/master "Code coverage on master branch")
![PyPI](https://img.shields.io/pypi/v/robotframework-robocop?label=version "PyPI package version")
![Python versions](https://img.shields.io/pypi/pyversions/robotframework-robocop "Supported Python versions")
![License](https://img.shields.io/pypi/l/robotframework-robocop "PyPI - License")
[![Downloads](https://static.pepy.tech/personalized-badge/robotframework-robocop?period=total&units=international_system&left_color=grey&right_color=orange&left_text=downloads)](https://pepy.tech/project/robotframework-robocop)

---

<img style="float:right" src="https://raw.githubusercontent.com/MarketSquare/robotframework-robocop/main/docs/source/images/robocop_logo_small.png">

Robocop
===============

- [Introduction](#introduction)
- [Documentation](#documentation)
- [Requirements](#requirements)
- [Installation](#installation)
- [Usage](#usage)
- [Example Output](#example-output)
- [Values](#values)
- [Fixing issues](#fixing-issues)
- [FAQ](#faq)

---

Introduction
------------

Robocop is a tool that performs static code analysis and formatting of [Robot Framework](https://github.com/robotframework/robotframework) code.

It uses official [Robot Framework parsing API](https://robot-framework.readthedocs.io/en/stable/) to parse files and runs number of checks,
looking for potential errors or violations to code quality standards (commonly referred as *linting issues*).

> Hosted on [GitHub](https://github.com/MarketSquare/robotframework-robocop).

Documentation
-------------

Full documentation is available [here](https://robocop.readthedocs.io). :open_book:

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

Requirements
------------

Python 3.9+ :snake: and Robot Framework 4.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:

```commandline
robocop format
```

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

```
robocop -h
```

Example Output
--------------

Executing command:

```
robocop check --report rules_by_error_type test.robot
```


Will result in the following output:

```text
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.
```

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

> First Directive: **Serve the public trust** :family_man_woman_girl_boy:

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** :baby:

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

> Third Directive: **Uphold the law** :classical_building:

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

FAQ
---
<details>
  <summary>Can I integrate Robocop with my code editor (IDE)?</summary>

  **Yes**, Robocop integrates nicely with popular IDEs like PyCharm or VSCode
  thanks to [RobotCode](https://github.com/robotcodedev/robotcode) plugin.
  Read simple manual (README) in that project to figure out how to install & use it.

</details>

<details>
  <summary>Can I load configuration from file?</summary>

  **Yes**, you can use toml-based configuration files:

  **`pyproject.toml` file**
  **`robocop.toml` file**
  **`robot.toml` file**

  Example configuration file:

  ```toml
  [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 top configuration file. Read more in
  [configuration](https://robocop.readthedocs.io/en/stable/configuration/configuration.html).

</details>

<details>
  <summary>I use different coding standards. Can I configure rules so that they fit my needs?</summary>

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

  ```commandline
  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](https://robocop.readthedocs.io/en/stable/rules/rules_basics.html#selecting-and-ignoring-rules).

</details>

<details>
  <summary>Can I define custom rules?</summary>

  **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 rules.py,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](https://github.com/MarketSquare/robotframework-robocop/pulls).
  You can also share your idea by
  [creating an issue](https://github.com/MarketSquare/robotframework-robocop/issues/new/choose).

  More about custom rules with code examples in
  [our documentation](https://robocop.readthedocs.io/en/stable/rules/external_rules.html).
</details>

<details>
  <summary>Can I use Robocop in continuous integration (CI) tools?</summary>

  **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 [reports](https://robocop.readthedocs.io/en/stable/integrations.html).

</details>

----

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

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "robotframework-robocop",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "Bartlomiej Hirsz <bartek.hirsz@gmail.com>",
    "keywords": "automation, formatter, formatting, linter, qa, robotframework, testautomation, testing",
    "author": null,
    "author_email": "Bartlomiej Hirsz <bartek.hirsz@gmail.com>, Mateusz Nojek <matnojek@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3f/c3/4485ce08160f33dffac399cb560ae92cf0755e9b18489edd307cfe92a908/robotframework_robocop-6.5.2.tar.gz",
    "platform": null,
    "description": "[![Unit tests](https://github.com/MarketSquare/robotframework-robocop/actions/workflows/tests.yml/badge.svg)](https://github.com/MarketSquare/robotframework-robocop/actions/workflows/unit-tests.yml \"GitHub Workflow Unit Tests Status\")\n![Codecov](https://img.shields.io/codecov/c/github/MarketSquare/robotframework-robocop/master \"Code coverage on master branch\")\n![PyPI](https://img.shields.io/pypi/v/robotframework-robocop?label=version \"PyPI package version\")\n![Python versions](https://img.shields.io/pypi/pyversions/robotframework-robocop \"Supported Python versions\")\n![License](https://img.shields.io/pypi/l/robotframework-robocop \"PyPI - License\")\n[![Downloads](https://static.pepy.tech/personalized-badge/robotframework-robocop?period=total&units=international_system&left_color=grey&right_color=orange&left_text=downloads)](https://pepy.tech/project/robotframework-robocop)\n\n---\n\n<img style=\"float:right\" src=\"https://raw.githubusercontent.com/MarketSquare/robotframework-robocop/main/docs/source/images/robocop_logo_small.png\">\n\nRobocop\n===============\n\n- [Introduction](#introduction)\n- [Documentation](#documentation)\n- [Requirements](#requirements)\n- [Installation](#installation)\n- [Usage](#usage)\n- [Example Output](#example-output)\n- [Values](#values)\n- [Fixing issues](#fixing-issues)\n- [FAQ](#faq)\n\n---\n\nIntroduction\n------------\n\nRobocop is a tool that performs static code analysis and formatting of [Robot Framework](https://github.com/robotframework/robotframework) code.\n\nIt uses official [Robot Framework parsing API](https://robot-framework.readthedocs.io/en/stable/) to parse files and runs number of checks,\nlooking for potential errors or violations to code quality standards (commonly referred as *linting issues*).\n\n> Hosted on [GitHub](https://github.com/MarketSquare/robotframework-robocop).\n\nDocumentation\n-------------\n\nFull documentation is available [here](https://robocop.readthedocs.io). :open_book:\n\nMost common questions with answers can be found at the bottom \u2b07 of this README file.\n\nRequirements\n------------\n\nPython 3.9+ :snake: and Robot Framework 4.0+ :robot:.\n\nInstallation\n------------\n\nYou can install the latest version of Robocop simply by running:\n\n```\npip install -U robotframework-robocop\n```\n\n\nUsage\n-----\n\nRobocop runs by default from the current directory, and it discovers supported files recursively.\nTo lint the files you can run:\n\n```\nrobocop check\n```\n\nTo format the files you can run:\n\n```commandline\nrobocop format\n```\n\nAll command line options can be displayed in help message by executing:\n\n```\nrobocop -h\n```\n\nExample Output\n--------------\n\nExecuting command:\n\n```\nrobocop check --report rules_by_error_type test.robot\n```\n\n\nWill result in the following output:\n\n```text\ntest.robot:17:1 SPC22 Not enough whitespace after 'Test Teardown' setting\n    |\n 15 |\n 16 | Test Setup Keyword\n 17 | Test Teardown Keyword2\n    | ^ SPC22\n 18 | Testtimeout 1min\n 19 | Documentation this is doc\n    |\n\ntest.robot:28:1 SPC14 Variable in Variables section is not left aligned\n   |\n 1 | *** Variables ***\n 2 | ${VAR} 1\n 3 |  ${VAR}  1\n   | ^ SPC14\n 4 |   ${VAR}  1\n 5 | VALUE  1\n\nFound 2 issues: 2 ERRORs, 0 WARNINGs, 0 INFO.\n```\n\nValues\n-------\nOriginal *RoboCop* - a fictional cybernetic police officer :policeman: - was following 3 prime directives\nwhich also drive the progress of Robocop linter:\n\n> First Directive: **Serve the public trust** :family_man_woman_girl_boy:\n\nWhich lies behind the creation of the project - to **serve** developers and testers as a tool to build applications they can **trust**.\n\n> Second Directive: **Protect the innocent** :baby:\n\n**The innocent** testers and developers have no intention to produce ugly code but sometimes, you know, it just happens,\nso Robocop is there to **protect** them.\n\n> Third Directive: **Uphold the law** :classical_building:\n\nFollowing the coding guidelines established in the project are something very important to keep the code clean,\nreadable and understandable by others and Robocop can help to **uphold the law**.\n\nFAQ\n---\n<details>\n  <summary>Can I integrate Robocop with my code editor (IDE)?</summary>\n\n  **Yes**, Robocop integrates nicely with popular IDEs like PyCharm or VSCode\n  thanks to [RobotCode](https://github.com/robotcodedev/robotcode) plugin.\n  Read simple manual (README) in that project to figure out how to install & use it.\n\n</details>\n\n<details>\n  <summary>Can I load configuration from file?</summary>\n\n  **Yes**, you can use toml-based configuration files:\n\n  **`pyproject.toml` file**\n  **`robocop.toml` file**\n  **`robot.toml` file**\n\n  Example configuration file:\n\n  ```toml\n  [tool.robocop]\n  exclude = [\"deprecated.robot\"]\n  \n  [tool.robocop.lint]\n  select = [\n    \"rulename\",\n    \"ruleid\"\n  ]\n  configure = [\n      \"line-too-long.line_length=110\"\n  ]\n  \n  [tool.robocop.format]\n  select = [\"NormalizeNewLines\"]\n  configure = [\n      \"NormalizeNewLines.flatten_lines=True\"\n  ]\n  ```\n\n  Multiple configuration files are supported. However, global-like options such as ``--verbose`` or ``--reports`` are\n  only loaded from top configuration file. Read more in\n  [configuration](https://robocop.readthedocs.io/en/stable/configuration/configuration.html).\n\n</details>\n\n<details>\n  <summary>I use different coding standards. Can I configure rules so that they fit my needs?</summary>\n\n  **Yes**, some rules and formatters are configurable. You can find the configuration details in the documentation or\n  by running:\n\n  ```commandline\n  robocop docs rule_name_or_id\n  robocop docs formatter_name\n  ```\n\n  Configuring is done by using `-c / --configure` command line option followed by pattern\n  `<name>.<param_name>=<value>` where:\n  - `<name>` can either be rule name or its id, or formatter name\n  - `<param_name>` is a public name of the parameter\n  - `<value>` is a desired value of the parameter\n\n  For example:\n\n  ```\n  robocop check --configure line-too-long.line_length=140\n  ```\n\n  ---\n  Each rule's severity can also be overwritten. Possible values are\n  `e/error`, `w/warning` or `i/info` and are case-insensitive. Example:\n\n  ```\n  robocop check -c too-long-test-case.severity=e\n  ```\n\n  ---\n  If there are special cases in your code that violate the rules,\n  you can also exclude them in the source code.\n\n  Example:\n\n  ```\n  Keyword with lowercased name  # robocop: off\n  ```\n\n  More about it in\n  [our documentation](https://robocop.readthedocs.io/en/stable/rules/rules_basics.html#selecting-and-ignoring-rules).\n\n</details>\n\n<details>\n  <summary>Can I define custom rules?</summary>\n\n  **Yes**, you can define and include custom rules using `--custom-rules` command line option\n  by providing a path to a file containing your rule(s):\n  ```\n  robocop --custom-rules my/own/rule.py --custom-rules rules.py,external_rules.py\n  ```\n\n  If you feel that your rule is very helpful and should be included in Robocop permanently,\n  you can always share your solution by\n  [submitting a pull request](https://github.com/MarketSquare/robotframework-robocop/pulls).\n  You can also share your idea by\n  [creating an issue](https://github.com/MarketSquare/robotframework-robocop/issues/new/choose).\n\n  More about custom rules with code examples in\n  [our documentation](https://robocop.readthedocs.io/en/stable/rules/external_rules.html).\n</details>\n\n<details>\n  <summary>Can I use Robocop in continuous integration (CI) tools?</summary>\n\n  **Yes**, Robocop is able to produce different kinds of reports that are supported by most popular platforms such as\n  GitHub, Gitlab, Sonar Qube etc. Read more in [reports](https://robocop.readthedocs.io/en/stable/integrations.html).\n\n</details>\n\n----\n\n> Excuse me, I have to go. Somewhere there is a crime happening. - Robocop\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Static code analysis tool (linter) and code formatter for Robot Framework",
    "version": "6.5.2",
    "project_urls": {
        "Bug tracker": "https://github.com/MarketSquare/robotframework-robocop/issues",
        "Documentation": "https://robocop.readthedocs.io/",
        "Homepage": "https://robocop.readthedocs.io/",
        "Source code": "https://github.com/MarketSquare/robotframework-robocop"
    },
    "split_keywords": [
        "automation",
        " formatter",
        " formatting",
        " linter",
        " qa",
        " robotframework",
        " testautomation",
        " testing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a03ed1dab31517314ed61d09bab4dbfb93b64df7458ea3fd754c0ca89f1f93fc",
                "md5": "fe4200c8844bf79bc73edeabf1001073",
                "sha256": "d77319a984fa4c87b2af619b178a23ebc971faf1830aa25d6de21869f5ec6464"
            },
            "downloads": -1,
            "filename": "robotframework_robocop-6.5.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fe4200c8844bf79bc73edeabf1001073",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 238785,
            "upload_time": "2025-08-01T15:14:12",
            "upload_time_iso_8601": "2025-08-01T15:14:12.905227Z",
            "url": "https://files.pythonhosted.org/packages/a0/3e/d1dab31517314ed61d09bab4dbfb93b64df7458ea3fd754c0ca89f1f93fc/robotframework_robocop-6.5.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3fc34485ce08160f33dffac399cb560ae92cf0755e9b18489edd307cfe92a908",
                "md5": "f0299aab735acc71934c94059ad98d8f",
                "sha256": "1322e420e64eae8c462310e305f9e54761feda91099d66726ad027a0fda5b172"
            },
            "downloads": -1,
            "filename": "robotframework_robocop-6.5.2.tar.gz",
            "has_sig": false,
            "md5_digest": "f0299aab735acc71934c94059ad98d8f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 666367,
            "upload_time": "2025-08-01T15:14:14",
            "upload_time_iso_8601": "2025-08-01T15:14:14.535438Z",
            "url": "https://files.pythonhosted.org/packages/3f/c3/4485ce08160f33dffac399cb560ae92cf0755e9b18489edd307cfe92a908/robotframework_robocop-6.5.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-01 15:14:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MarketSquare",
    "github_project": "robotframework-robocop",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "robotframework-robocop"
}
        
Elapsed time: 1.15570s