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

Overview

Unit-tests Codecov PyPI Python versions Licence Downloads


Robocop

Watch our talk from RoboCon 2021 about Robocop and Robotidy and learn more about these cool tools! ๐Ÿค–

Robocop & Robotidy presentation at RoboCon 2021


Introduction

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

It uses official Robot Framework parsing API to parse files and run number of checks, looking for potential errors or violations to code quality standards.

Hosted on GitHub. ๐ŸŽ–๏ธ

Documentation

Full documentation available here. ๐Ÿ“–

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

Values

Original RoboCop - a fictional cybernetic police officer ๐Ÿ‘ฎโ€โ™‚๏ธ - was following 3 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 to produce 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 very important to keep the code clean, readable and understandable by others and Robocop can help to uphold the law.

Requirements

Python 3.6+ ๐Ÿ and Robot Framework 3.2.2+ ๐Ÿค– .

Installation

You can install 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. You can simply run::

robocop

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

robocop -h

Example Output

Executing command::

robocop --report rules_by_error_type tests\test.robot

Will result in following output::

C:\OCP_project\tests\test.robot:7:1 [W] 0509 Section is empty (empty-section)
C:\OCP_project\tests\test.robot:22:1 [E] 0801 Multiple test cases with name "Simple Test" in suite (duplicated-test-case)
C:\OCP_project\tests\test.robot:42:1 [E] 0810 Both Task(s) and Test Case(s) section headers defined in file (both-tests-and-tasks)
C:\OCP_project\tests\test.robot:48:1 [W] 0302 Keyword name should use title case (wrong-case-in-keyword-name)
C:\OCP_project\tests\test.robot:51:13 [I] 0606 This tag is already set by Force Tags in suite settings (tag-already-set-in-force-tags)

Found 5 issue(s): 2 WARNING(s), 2 ERROR(s), 1 INFO(s).

Fixing issues

Many issues in your code reported by Robocop can be fixed using auto-formatting tool, Robotidy. Check out the Robotidy documentation.

FAQ

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

Yes, Robocop integrates nicely with popular IDEs like PyCharm or VSCode thanks to Robot Framework Language Server. Read simple manual (README) in that project to figure out how to install & use it.

You can also use Robocop in PyCharm easily as an external tool. To configure it, go to: File โ†’ Settings โ†’ Tools โ†’ External Tools and click + icon. Then put values based on official instructions or this screenshot:

Robocop

If you're using Python virtual environment in your project, make sure to provide correct path to robocop.exe located in venv\Scripts\robocop.exe. Now, you can run Robocop by right-clicking on a file or directory and choosing External tools โ†’ Robocop.

We suggest also to add a keyboard shortcut (e.g. Ctrl + , (comma)) to quickly run Robocop on selected files. You can map the shortcut in Settings โ†’ Keymap.

Can I load configuration from file?

Yes, there are multiple ways to configure Robocop:

Argument file

You can add command line options to an argument file, preferably one option with value for a line. Such file can be used as an input for Robocop with --argumentfile / -A option, e.g. robocop -A robocop.cfg. You can mix arguments from a file with ones provided in run command.

Example argument file:

--exclude *doc*
--exclude 0510
--threshold W
--configure inconsistent-assignment:assignment_sign_type:equal_sign
--configure line-too-long:line_length:140
--reports all
--output robocop.log

.robocop file

It is a default file that is loaded only when no command line options are provided for Robocop. When running plain robocop command, it looks for .robocop file from place where it was run until it finds .git file. Options can be provided like in the example above.


pyproject.toml file

If there is no .robocop file and toml module is installed, Robocop will try to load configuration from pyproject.toml file (if it exists). Options have the same names as command line arguments and need to be placed under [tool.robocop] section.

Example configuration file:

[tool.robocop]
paths = [
    "tests\\atest\\rules\\bad-indent",
    "tests\\atest\\rules\\duplicated-library"
]
include = ['W0504', '*doc*']
exclude = ["0203"]
reports = [
    "rules_by_id",
    "scan_timer"
]
ignore = ["ignore_me.robot"]
ext-rules = ["path_to_external\\dir"]
filetypes = [".txt", ".tsv"]
threshold = "E"
format = "{source}:{line}:{col} [{severity}] {rule_id} {desc} (name)"
output = "robocop.log"
configure = [
    "line-too-long:line_length:150",
    "0201:severity:E"
]
no_recursive = true
I use different coding standards. Can I configure rules so that they fit my needs?

Yes, some rules are configurable. You can list them by running robocop --list-configurables or just robocop -lc.

Configuring is done by using -c / --configure command line option followed by pattern : : where:

  • can either be rule name or its id
  • is a public name of the parameter
  • is a desired value of the parameter

For example:

--configure line-too-long:line_length:140

is equivalent to

-c 0508: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:

-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: disable

More about it in our documentation.

Can I define custom rules?

Yes, you can define and include custom rules using -rules / --ext-rules command line option by providing a path to a file containing your rule(s). The option accepts comma-separated list of paths to files or directories, e.g.

robocop -rules my/own/rule.py --ext-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. You can also share your idea by creating an issue.

More about external rules with code examples in our documentation.

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

Yes, it is easy to integrate Robocop with other tools. It is possible to redirect the output to a file by using -o / --output command line option which can later be easily parsed because the format is very similar to other linter tools like pylint.

For example in Jenkins you can use Warnings Next Generation plugin to integrate Robocop results in your pipeline. More details can be found here.

One of the important topics related to CI is return code which can also be configured in Robocop. More on that can be found in the next question or in our documentation.

Can I configure return status / code?

Yes, by default Robocop returns code 0 if number of found issues does not exceed quality gates.

Quality gates are the number specified for each severity (error, warning, info) that cannot be exceeded. Every violation of quality gates increases the return code by 1 up to maximum of 255. Default values for quality gates are:

quality_gate = {
          'E': 0,
          'W': 0,
          'I': -1
      }

which shows the accepted number of issues by severity. In that case each error and warning increases the return code. Rules with INFO severity do not affect the return code.

To configure quality gates, you simply use -c / --configure command line option with following pattern --configure return_status:quality_gates: =limit . You can change all limits at once. Example:

--configure return_status:quality_gates:E=0:W=100:I=-1

which means that no errors are accepted, up to 100 warnings are tolerated and issues with INFO severity do not affect the return code.

What is the difference between Robocop and rflint?

Robocop is better in every case because it:

  • has maaaaany rules that check the quality of your Robot Framework code
  • is integrated with popular IDE tools
  • is highly configurable
  • has very good defaults that work out of the box
  • can be configured in source code
  • uses latest Robot Framework Parsing API
  • is actively developed & fixed
  • is easy to integrate with external tools
  • can redirect output to a file
  • displays nice reports
  • is easy to extend it with new rules
  • is cool ๐Ÿค“

Still not convinced? Watch our talk about Robocop & Robotidy and see for yourself! ๐Ÿง


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

Comments
  • Add client-server mode with API

    Add client-server mode with API

    Client-server mode with API could be used by IDEs or separate programs for file scanning "on the fly" without need to wrap Robocop.

    Example:

    robocop = Robocop.server(*args)
    robocop.scan_file(file)
    robocop.scan_file(file)
    ...
    robocop.scan_file(file)
    

    Returned output would need to be different than std.out (for example json object) so it would be handled by other tools.

    enhancement 
    opened by bhirsz 20
  • Sarif support for integration with GitHub security

    Sarif support for integration with GitHub security

    Can you add Sarif export support to the export of the scans so the data can be uploaded to GitHub Advanced Security? This would give us a consolidated view of all the code quality issues.

    opened by ds-dustenharrison 15
  • configurable terms for todo-in-comment

    configurable terms for todo-in-comment

    It would be good if todo-in-comment rule has configurable terms.

    E.g. robocop --configure todo-in-comment:todos:OMG,bug also this work robocop --configure "todo-in-comment:todos:remove me,fix this ugly bug" This should enable also terms in local language.

    ~~Work in progress: documentation, tests~~

    What would be the best location to place rule configuration tests?

    opened by rikerfi 13
  • New doc theme and docs fixes

    New doc theme and docs fixes

    Closes #563

    @mnojek please check it visually - I can modify pretty much everything through custom css (spacing, padding, colours etc). I switched from rtd theme to Sphinx default alabaster theme. You can build documentation locally with:

    tox -e docs
    

    Documentation will be under docs/_build/index.html

    opened by bhirsz 12
  • Create at least one report that logs date and time of checking RF scripts

    Create at least one report that logs date and time of checking RF scripts

    When I run robocop with -o myfolder/robocop.log saving the logs at the same place, I just need to refresh the log file. But I want to be sure that the most recent robocop result is displayed.

    Currently I run Robocop with all reports and I get a log like this:

    grafik

    Wouldn't it be good to have at least one report that logs date and time when robocop was ended?

    Either as an own report or as extension of existing reports, e.g.:

    • Report generated on 2022-07-04 17:50 by Robocop version: 2.1.0,
    • Scan finished in 5.973s on 2022-07-04 17:50
    opened by UliSei 11
  • Check indentation completely

    Check indentation completely

    I suggest to implement all-catching check of indentation. The current rules regarding indentation ([W1007] uneven-indent and [E1008] bad-indent) allow me to indent very sloppily. ๐Ÿ˜„ It could work roughly like this:

    • One level of indentation is either one tab or 4 spaces (this "4" would be default, but configurable)
    • Names of keywords and test cases in definition are not indented. Their bodies are indented by 1 level.
    • In FOR-cycles and IF-branches, stuff is indented one more level than "FOR" or "IF"
    • Continuation line has the same indentation as the line which the continuation line "extends".
    • Lines containing only comments are indented either like the preceding, or the following non-empty line.
    • (Is there any other case influencing indentation?)

    I do not know whether Robocop is ready for such a rule, but it is able to work with indentation even now, so I hope so...

    opened by MoreFamed 11
  • Embedded keywords with variable are treated as not capitalised

    Embedded keywords with variable are treated as not capitalised

    Describe the bug Embedded keywords with variable are treated as not capitalised, while IMHO they are fine formatted.

    To Reproduce Run robocop against file containing following code

    *** Variables ***
    ${variable}    does not matter
    
    *** Test Cases ***
    Test Capitalised
        Embedded Keyword With ${variable}
    
    *** Keywords ***
    Embedded Keyword With ${variable}
        Log    ${variable}
    

    Results in [W] 0302 Keyword name should be capitalized message form Robocop

    Expected behavior Since common approach to variables is to have them lowercased or uppercase, for global variables/Constans, rule should ignore embedded variable casing.

    bug context reading 
    opened by MaciejWiczk 11
  • Reports json_report not working from command line execution[Bug]

    Reports json_report not working from command line execution[Bug]

    What happened?

    Hi, Reading the doc seems i can get a report with the list of issues found in JSON format with the command robocop -r json_report -o report.json file/to/parse.robot. But seems this doesn't work and instead I get a file with the classic text line "{source}:{line}:{col} [{severity}] {rule_id} {desc} ({name})"

    Is it a bug or am i missing something? thank you very much

    Operating System

    10.0.19042

    Robocop version

    1.12.0

    bug 
    opened by ZephyrusMB 10
  • Problem with uneven-indent rule

    Problem with uneven-indent rule

    Consider following code snippet:

    *** Settings ***
    Documentation  Suite doc
    
    
    *** Keywords ***
    My Keyword    # robocop: disable
        [Documentation]  Some doc
        No Operation
    
    

    It does not report any issues. But if we change line 6th and decrease the number of spaces between the keyword name and the comment (which is a Robocop disabler) by 2, so the line looks like this:

    My Keyword  # robocop: disable
    

    then we have this issue reported by Robocop: indent_robocop.robot:7:5 [W] 1007 Line is over-indented (uneven-indent) which should not happen.

    bug rule 
    opened by mnojek 10
  • [Bug] Rule #1005 ignores comment lines

    [Bug] Rule #1005 ignores comment lines

    What happened?

    An example code

    Keyword1
         Keyword2
    
    # Comment
    
    Keyword3
         Keyword4
    

    won't pass the rule 1005 (empty-lines-between-keywords). The received output will be as follows:

    Invalid number of empty lines between keywords (2/1)

    It's down to preferences, but as a RF user I see use cases for having e.g. keyword library section separators (and multiple other use cases) that could be done with single-line comments between keywords.

    Operating System

    Windows

    Robocop version

    2.0.2

    bug 
    opened by antonpaa 9
  • [Bug] Not enough whitespace after ... mark is recognized as new variable

    [Bug] Not enough whitespace after ... mark is recognized as new variable

    This code:

    ${VARIABLE}=
    ... """                                            ${\n}
    ... data:                             ${\n}
    ... ( a b c ) = ( 1  2  3 ) ${\n}
    ... """
    

    produces:

    test.robot:23:0 [E] 0803 Multiple variables with name "... """" in Variables section. Note that Robot Framework is case-insensitive (duplicated-variable)
    test.robot:26:0 [E] 0803 Multiple variables with name "... """" in Variables section. Note that Robot Framework is case-insensitive (duplicated-variable)
    

    I think it should rather be catched by "not-enough-whitespace-after-newline-marker" rule (but it's keyword naming rule.. maybe we should export it to be general rule checking all statements that starts from the beginning of line and contains ...?)

    bug 
    opened by bhirsz 9
  • SonarQube module for Robocop

    SonarQube module for Robocop

    Hello,

    In order to follow up the code quality of our robot framework scripts, we are interested to have a SonarQube module.

    Thank you in advance.

    KR,

    Aurรฉlien

    opened by AurelienSoulet 0
  • [Bug] bad-indent when using data-driven style tests with `[Tags]`

    [Bug] bad-indent when using data-driven style tests with `[Tags]`

    What happened?

    Whenย using data-driven style tests, and including [Tags], robocop gives errors like foobar.robot:15:37 [W] 1008 Line is over-indented (bad-indent)

    For the robot file:

    *** Settings ***
    Test Template       Login with invalid credentials should fail
    
    *** Test Cases ***                  USERNAME            PASSWORD
    Invalid User Name                   [Tags]              foo
                                        invalid             ${VALID PASSWORD}
    Invalid Password                    [Documentation]     foo
                                        [Tags]              bar
                                        ${VALID USER}       invalid
    Invalid User Name and Password      [Tags]              baz
                                        invalid             invalid
    Empty User Name
                                        ${EMPTY}            ${VALID PASSWORD}
    Empty Password                      ${VALID USER}       ${EMPTY}
                                        [Tags]              spam  eggs
    Empty User Name and Password        ${EMPTY}            ${EMPTY}
    
    
    *** Keywords ***
    Login With Invalid Credentials Should Fail
        [Arguments]    ${username}    ${password}
        No Operation
    

    Editing the lines with errors (removing spaces until it no longer gives any indentation related errors) gives the following. It looks like it is subtracting the length of the test case name from the number of required spaces.

    *** Settings ***
    Test Template       Login with invalid credentials should fail
    
    *** Test Cases ***                  USERNAME            PASSWORD
    Invalid User Name                   [Tags]              foo
                       invalid             ${VALID PASSWORD}
    Invalid Password                    [Documentation]     foo
                                        [Tags]              bar
                                        ${VALID USER}       invalid
    Invalid User Name and Password      [Tags]              baz
          invalid             invalid
    Empty User Name
                                        ${EMPTY}            ${VALID PASSWORD}
    Empty Password                      ${VALID USER}       ${EMPTY}
                          [Tags]              spam  eggs
    Empty User Name and Password        ${EMPTY}            ${EMPTY}
    
    
    *** Keywords ***
    Login With Invalid Credentials Should Fail
        [Arguments]    ${username}    ${password}
        No Operation
    

    Related robotidy issue: https://github.com/MarketSquare/robotframework-tidy/issues/443

    Operating System

    No response

    Robocop version

    2.6.0

    bug 
    opened by Zeckie 0
  • Bump robotframework from 5.0.1 to 6.0.1 in /tests/packages/rf-stable5

    Bump robotframework from 5.0.1 to 6.0.1 in /tests/packages/rf-stable5

    Bumps robotframework from 5.0.1 to 6.0.1.

    Release notes

    Sourced from robotframework's releases.

    Robot Framework 6.0.1 is the first bug fix release in the RF 6.0 series. It mainly fixes a bug in using localized BDD prefixes consisting of more than one word (#4515) as well as a regression related to the library search order (#4516).

    For more details see the full release notes.

    Robot Framework 6.0 is a new major release that starts Robot Framework's localization efforts. In addition to that, it contains several nice enhancements related to, for example, automatic argument conversion and using embedded arguments. Initially it had version 5.1 and was considered a feature release, but it grow so big that we decided to call it a major release instead.

    For more details see the full release notes.

    Robot Framework 6.0 rc 2

    Robot Framework 6.0 is a new major release that starts Robot Framework's localization efforts. In addition to that, it contains several nice enhancements related to, for example, automatic argument conversion and using embedded arguments. Robot Framework 6.0 rc 2 is the second and hopefully the last release candidate containing all features and fixes planned to be included in the final release.

    Robot Framework 6.0 was initially labeled Robot Framework 5.1 and considered a feature release. In the end it grow so big that we decided to make it a major release instead.

    For more details see the full release notes.

    Robot Framework 6.0 rc 1

    Robot Framework 6.0 is a new major release that starts Robot Framework's localization efforts. In addition to that, it contains several nice enhancements related to, for example, automatic argument conversion and using embedded arguments. Robot Framework 6.0 rc 1 is the first and hopefully also the last release candidate containing all features and fixes planned to be included in the final release.

    Robot Framework 6.0 was initially labeled Robot Framework 5.1 and considered a feature release. In the end it grow so big that we decided to make it a major release instead.

    For more details see the full release notes.

    Robot Framework 5.1 beta 2

    Robot Framework 5.1 is a new feature release that starts Robot Framework's localization efforts and also brings in other nice enhancements. Robot Framework 5.1 preview releases are targeted especially for people interested in translations.

    For more details see the full release notes.

    Robot Framework 5.1 beta 1

    Robot Framework 5.1 is a new feature release that starts Robot Framework's localization efforts and also brings in other nice enhancements. Robot Framework 5.1 preview releases are targeted especially for people interested in translations.

    For more details see the full release notes.

    Robot Framework 5.1 alpha 2

    Robot Framework 5.1 is a new feature release that starts Robot Framework's localization efforts and also brings in other nice enhancements. Robot Framework 5.1 alpha releases are targeted especially for people interested in translations.

    For more details see the full release notes.

    Robot Framework 5.1 alpha 1

    Robot Framework 5.1 is a new feature release that starts Robot Framework's localization efforts and also brings in other nice enhancements. Robot Framework 5.1 alpha 1 is the first preview release targeted especially for people interested in translations.

    For more details see the full release notes.

    Commits
    • 677976a Updated version to 6.0.1
    • 03f0119 Release notes for 6.0.1
    • a5b698d Fix version numbers in docs and in a warning. Fixes #4525.
    • 628b44b Fix unit test failing around DST. Fixes #4523.
    • e1ccafe Add timedelta support to timestr_to_secs.
    • e4bdf02 Fix DocumentationBuilder w/ resource files having .robot extension.
    • 6c92dd4 Enhance docs of Libdoc's public API. Fixes #4520.
    • acc61b8 Fix search order w/ two matches when one is from std lib.
    • 886ffcf Fix multipart BDD prefixes. #4515
    • 314f398 API doc typo fix
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 1
  • Could the `dateutil` dependency by dropped?

    Could the `dateutil` dependency by dropped?

    From what I see it's only usage is to get the local timezone, but this is available from the datetime directly.

    See: https://stackoverflow.com/a/52606421/110451

    Or am I missing something here?

    opened by fabioz 2
  • Could the `packaging` dependency be dropped?

    Could the `packaging` dependency be dropped?

    From what I can see, packaging is used just for its Version and it checks mostly the major/minor versions, where getting the major/minor version through a split with . and using it as a tuple only with major/minor should suffice.

    This dep brings or pyparsing too, so, it brings up a lot of code just to check the version...

    As for the reason for me, sometimes I do have issues because a version of robocop is vendored in the language server, which means it's not pip-installed, but if the user has an older version of packaging installed in its env robocop doesn't really work...

    opened by fabioz 1
Releases(2.6.0)
  • 2.6.0(Oct 19, 2022)

  • 2.5.0(Sep 14, 2022)

    Several changes to our spacing and comments rules and also initial suppport for Robot Framework 5.1 features such as languages or AS markers.

    Robot Framework 5.1 support

    Language markers

    Robocop now supports reading the Robot Framework files in different languages using --language option. More details in our docs (#646).

    WITH NAME deprecated in favour of AS

    Alias for library import can be now defined using AS marker (same as in Python). WITH NAME will be gradually deprecated in the future Robot Framework versions. That's why we added support for AS marker to existing rules and created new rule deprecated-with-name which will warn on WITH NAME usage starting from RF 5.1 (#642).

    Empty lines handling refactor (#708)

    We changed how we're recognizing the empty lines in spacing rules. Previously consecutive-empty-lines, empty-lines-between-keywords and empty-lines-between-test-cases rules ignored comments. This lead to suprising behaviours, for example following code reported three empty lines between keywords:

    *** Keywords ***
    Keyword
        Pass
    
        # comment 1
    
    # comment 2
    
    Second Keyword
        Pass
    
    

    Detecting end of the keyword / test was also not working correctly (in above example # comment 1 should belong to Keyword and do not count towards empty lines between keywords). consecutive-empty-lines now also works inside IF, FOR, WHILE and TRY blocks.

    Configurable todo-in-comment

    New markers parameter in todo-in-comment rule that allows to define your own markers that should be reported when found in the comment (#674).

    Configurable block comments in missing-space-after-comment

    New block parameter in missing-space-after-comment rule that allows to define pattern for block comments that should be ignored by the rule (#689)

    Keywords inside run keywords are now parsed

    Keywords inside keywords like Run Keywords or Run Keyword If are now recognized and handled by keyword rules (#691, #520).

    Fixes

    • too-few-calls-in-test-case now properly count keywords inside templated tests. It is now also possible to ignore templated tests in too-few-calls-in-test-case rule with ignore_templated parameter (#685)
    • too-few-calls-in-test-case and too-few-calls-in-keyword now counts new RF 5.0 syntax (such as RETURN or BREAK statements). The code inside IF, FOR, WHILE and TRY blocks is now also recognized by those rules (#704)
    • several naming rules now reports with more precise location (#290)
    • duplicated import name now acknowledge the aliased name (#699)
    • external rules are now properly loaded from installed Python module (#709)
    • critical failures in Robot Framework that cause Robocop to stop working are now wrapped with more user friendly message (#586)

    Acknowledgements

    Big thanks to everyone: @ger-kil, @Lucas-C, @antonpaa and @UliSei for raising issues and helping to improve our documentation. @rikerfi for extending our comment rules

    Source code(tar.gz)
    Source code(zip)
  • 2.4.0(Aug 26, 2022)

    Several improvements and fixes for Robocop reports & first updates for upcoming Robot Framework 5.1 release. Rule severity can be also be dynamic depending on the rule other parameters.

    Reports improvements & fixes

    • Not all reports will be generated when using --reports all option. Some reports were internal only or produced files which may be not desired. Reports that are not enabled by all and only with specific mention (ie --reports sarif) are marked in our docs (reports docs) (#662)
    • It is possible now to change order of the reports in the output using --reports option. Before this release reports were generated in order they are implemented in Robocop code. Now if typu configure --reports x,y then first report x and then report y will be generated. You can also combine it with all if you only want one report at the top and rest in default order: --reports x,all (#664)
    • Invalid report name will now fail and suggest alternative if you made a typo - previously invalid report name was silenty ignored. For example it was possible to configure --reports timestamps (instead of timestamp) and user was not aware of it (#665)

    Sarif report

    Robocop can now generate report in sarif format. This format is accepted by various CI platforms as result of code scanning and can be used to integrate into Github CI (more details in our docs) (#638)

    Configurable rule severity

    It is now possible to configure rule to report with different rule severity depending if the rule exceed given thresholds (#614). For example if you want line-too-long rule to issue warning on lines above 120 characters long and error on lines longer than 200 character you can configure it using severity_threshold:

    robocop -c line-too-long:line_length=120 -c line-too-long:severity_threshold:warning=120:error=200
    

    More on the feature in our docs.

    too-few-calls-in-test-case rule

    New rule too-few-calls-in-test-case. If the test case have less that allowed number of keyword calls (1 by default) it will report an error.

    Other

    • Replaced toml with tomli library (for parsing our configuration files). tomli library was selected to be part of Python vendored-in libraries in future Python release (#609)
    • Handle new reserved tags in Robot Framework 5.1 (#660)
    • You can ignore documentation in too-long-test-case and too-long-keyword rules with new ignore_docs parameter (False by default) (#613)
    • Relative paths in the pyproject.toml configuration file are now resolved using configuration file parent directory as parent (and not using tool current working directory which lead to unexpected behaviour) (#612)

    Acknowledgements

    Big thanks to @ds-dustenharrison, @bollwyvl, @adrszad, @ZephyrusMB, @phermann-DGL, @rikerfi for raising the issues and providing the feedback.

    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Jul 24, 2022)

    New report and small fix.

    Timestamp report

    Report that returns Robocop execution timestamp (#628 #637). Example:

    Reported: 2022-07-10 21:25:00 +0300
    

    Handle comments with separators inside

    When comment in Robot Framework contains more than one space of separator inside, it is recognized as two separate comments under the hood. It lead to a few small bugs when processing such comments - it is now resolved (#634). Additionally block comments (starting with ###) are now ignored by missing-space-after-comment rule.

    Acknowledgements

    Big thanks to @MoreFamed , @UliSei for raising the issues and @rikerfi for implementing the timestamp report.

    Source code(tar.gz)
    Source code(zip)
  • 2.2.0(Jul 11, 2022)

    Updates to rule severity and threshold handling.

    • Fixed the bug where the overriden rule severity wasn't taken into account by reports (#623)
    • Threshold severity can be now configured the same way the rule severity is configured (#624)
    • Invalid threshold value now raises an error instead of silently using INFO severity (#624)

    Other

    Updated Robocop python requirements to ">=3.6". The requirement did not change but we were missing this data in our metadata (#621).

    Acknowledgements ๐Ÿ’ช๐Ÿป

    @UliSei for raising the issues regarding our rule & threshold severity

    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Jun 20, 2022)

    This release is purely created by the community - big thanks!

    Version Report

    New report added by @rikerfi (#616). It will print Robocop version at the end of the scan:

    Report generated by Robocop version: 2.1.0
    

    You can configure it using "all" or "version":

    robocop --reports version src
    

    Naming rules changes

    Update to some of our naming rules done by @jannek76 (#615).

    • wrong-case-in-keyword-name rule received a new parameter: pattern. It allows you to define pattern that will be ignored from the keyword name. It's useful when Robocop doesn't detect the name of the keyword correctly (it works as a workaround for #595).

    • not-allowed-char-in-name split to not-allowed-char-in-name (which now covers test case and keyword names) and not-allowed-char-in-filename (which now covers suite names). Same as the original rule, not-allowed-char-in-filename also accepts patern that defines which characters are not allowed in a name. This split allows you to configure patern separately for suite and test/keyword names.

    Acknowledgements ๐Ÿ’ช๐Ÿป

    Big thanks to everyone! @jannek76 For improving our (not-so-simple) naming rules @rikerfi For adding new report

    Source code(tar.gz)
    Source code(zip)
  • 2.0.2(May 8, 2022)

    Robocop 2.0.2

    This 2.0.2 release ๐ŸŽ‰ includes fixes for various parts of Robocop ๐Ÿค– and improves documentation ๐Ÿ“–. Thanks everyone for finding the issues ๐Ÿž and reporting them back to us!

    Fixes ๐Ÿ›

    • Fixed rule W0319 (deprecated-statement) which reported deprecation on [Return] statement in RF4 (#589, #590)
    • Rule W0901 (keyword-after-return) no longer reports warning on [Return] not being the last statement when [Teardown] is used at the end of the keyword (#588, #591)
    • Updated rule W0302 (wrong-case-in-keyword-name) to better handle parenthesis used in keyword and test case names (#558, #596)
    • Updated rules W1004 (empty-lines-between-test-cases) and W1005 (empty-lines-between-keywords) to allow comments between keywords and test cases in corresponding sections (#513, #599)
    • Fixed rule W0319 (deprecated-statement) to show deprecation message for Run Keyword Unless keyword only in RF5 (#593, #598)
    • Updated message for rule W0302 (wrong-case-in-keyword-name) to "Keyword name '{{ keyword_name }}' does not follow case convention" to properly reflect what's being checked (#548, #600)
    • Updated rule I0912 (empty-variable) to properly mark variable type in recommendations for empty values (#592, #597)
    • Fixed rule W0202 (missing-doc-test-case) to not report on every test case when templated suite is used. Also, a new parameter ignore_templated (set to True by default) is introduced to configure whether the rule should report on missing documentation for each templated test case or not (possible values are: Yes / 1 / True (default) or No / False / 0) (#526, #602)

    Other ๐Ÿ“ˆ

    • Updated examples in documentation (README and User Guide) (#601)
    • Added examples in reports documentation (#601)
    • Robocop can now correctly say if a noun is plural or singular (e.g. 2 rules instead of 2 rule(s)) (#601)
    • Fixed small typos in documentation, docstrings and sorted imports in code (#603)
    • Removed repo visualization file (due to problems with related GitHub action) (#607)

    Acknowledgements ๐Ÿ’ช๐Ÿป

    Big thanks to a great community for finding and reporting bugs! You make the tool better and you rock :metal: (random order) @rousku for reporting bug on W0319 (#589) @IlfirinPL for reporting bugs on W0901 (#588) and I0912 (#592) @rikerfi for reporting bug on W0302 (#558) @polewczakp for reporting bug on W1004 (#513) @MoreFamed for reporting bug on W0319 (#593) @KUGA2 for reporting issue with W0302 rule's message (#548) @Leemur89 for reporting bug on W0202 (#526)

    Source code(tar.gz)
    Source code(zip)
  • 2.0.1(Mar 24, 2022)

    Fixes

    • Comment section without *** Comments *** section should now not fail when reporting empty-line-after-section (#582)
    • It is now safe to use Robocop 2.0 with Robot Framework 4.1.3 (without breaking on new syntax) (#583)

    Other

    • Our dependencies are sorted and normalized (#584)

    Acknowledgements

    Big thanks to @bollwyvl for improving how we define our dependencies and @oboehmer for finding the issue with sections rules.

    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Mar 24, 2022)

    Robocop 2.0

    1.5 year of Robocop's devoted service has passed this month but we already made him older with the version 2.0!

    The release includes support for Robot Framework 5.0 but the most important thing is that any custom user-created rules are not compatible with this version and need to be migrated (more about that below). Moreover, we improved our documentation with the examples for nearly every rule and the layout of the documentation also changed to a better one! There are 8 new rules, some others are improved, few fixes, performance enhancements and better exception handling. Please read the complete release notes to familiarize with what Robocop 2.0 has now to offer.

    We would also like to apologize that some bugs waited so long to be fixed. Our plan for the next release is to fix all bugs that are left in the backlog and add any missing support for RF 5.0. Next, we want to focus on any other features that we want Robocop to have.

    Backward-incompatible changes

    • The rules are now defined as class (instead of a tuple). (#516) This makes the code a lot more readable and creation of new rules is a lot easier but... is also causes all external rules created by the users not being compatible with RoboCop 2.0. They need to be migrated, so we recommend reading the "External Rules" chapter from our documentation to better understand how it works now. All built-in rules in Robocop are already migrated, but if you have some custom ones, you need to migrate them by yourself. In case of any questions or issues, ping as on our #robocop-linter Slack channel.
    • Rule W0603 (tag-with-reserved) name has changed to tag-with-reserved-word (#573)
    • Rule E0902 (keyword-after-return-from) has been removed and replaced with W0901 (keyword-after-return) (#576)

    Rules

    • NEW: W0609 (duplicated-tags) notifies if the same tag was used several times (#542, #291)
    • NEW: I0914 (if-can-be-merged) suggests merging several IF conditions into one, if they have identical conditions (#543, #441)
    • NEW: E0915 (statement-outside-loop) checks if keywords like Exit For Loop (If), Continue For Loop (If) or statements like BREAK, CONTINUE are used only inside the loop (#562, #477, #577)
    • NEW: W0608 (empty-tags) detects [Tags] setting in keywords and test cases that has no values (#508, #440)
    • NEW: W0813 (duplicated-setting) warns user about duplicated setting (e.g. Force Tags) (#572)
    • NEW: W0319 (deprecated-statement) reports when deprecated keyword is used depending on the RF version in use (#565, #560, #576)
    • NEW: E0414 (return-in-test-case) detects RETURN statements used outside the keywords (#576)
    • NEW: I0916 (inline-if-can-be-used) suggests whether to replace simple IF with new inline IF (#578, #546)
    • UPDATE: E0303 (keyword-name-is-reserved-word) supports detecting reserved names introduced in RF 5.0 (#570, #568)
    • UPDATE: E0401 (parsing-error) now also detects if positional argument is passed after named argument (#541, #474)
    • UPDATE: E0412 (invalid-for-loop) now better detects any syntax errors in FOR loop (#572)
    • UPDATE: W0603 (tag-with-reserved-word) is extended with another special tags with robot: prefix (#573, #559)
    • UPDATE: W0901 (keyword-after-return) replaces removed rule E0902 (keyword-after-return-from) (#576)
    • REMOVED: E0902 (keyword-after-return-from) (#576)

    Fixes

    • Robocop now properly parses keywords that are preceded with a library name (e.g. BuiltIn.Run Keyword If) (#519)
    • Some rules now better point to the place where the issue occurred
    • Many rules have more precise message (#533)
    • Using Gherkin syntax (given, When, Then, And) now doesn't throw an exception (#549, #550)

    Other

    • The documentation has been significantly improved with a lot of good practices with real-life examples about which code violates specific rule and why (#527, #468, #555)
    • (related to previous one) Rule class now accepts docs argument which is dedicated for providing the extended documentation for specific rule (#528)
    • (related to previous one) Jinja templating is now supported in rules' documentation, which means that instead of mystical rule message like "Section name should be in format '%s' or '%s'", it can now be defined as "Section name should be in format '{capitalized}' or '{uppercase}'" (#534, #535)
    • Robocop now skips reading paths defined in .gitignore file (#531, #476)
    • Exceptions handling has been significantly improved. Now all known issues or possible to catch errors should have much better descriptions and additional warning messages. Only unexpected issues now display stacktrace (#521, #530)
    • Some rules that are available only in a specific version of Robot Framework will be properly marked when calling robocop --list (enabled/disabled) (#532, #507)
    • New CLI argument -gd/--ignore-default now supports excluding directories and files (and it already has some nice default list of ignored paths) (#540, #475)
    • Robocop is now faster since it excludes some files and directories from parsing phase. Depending on the repository size, the execution time can be reduced up to 20% (#540, #475)
    • The documentation theme has been changed to "furo" - more readable one which includes better navigation and supports dropdowns (#567, #563)
    • version attribute can now be specified for each rule to define which Robot Framework version enables it (#545, #544)
    • Support for Robot Framework 5.0 including:
      • IF, ELSE & ELSE IF conditions support (#551)
      • Updated rule W0603 (more info in Rules section above) (#559)
      • Updated many tests to cover support for RF 5.0 syntax (#574)
      • New rule W0319 (more info in Rules section above) (#565)
      • New rule I0916 (more info in Rules section above) (#546)
    • Added performance tests that create JSON report with test results which later can be compared with previous results. They can be run with pytest --benchmark-enable tests. See here for more details. (#495, #467)
    • Configuration file is now always loaded first by default and any CLI arguments append to it (#512)
    • General code refactor, updated links in documentation, improved comments and print messages (#577)
    • Added Python 3.10 support (#577)
    • Removed deprecation warnings for the rules updated in the previous releases:
      • "missing-whitespace-after-setting" which is now "not-enough-whitespace-after-setting",
      • "variable-should-left-aligned" which is now "variable-should-be-left-aligned",
      • "0304" which is now "0406",
      • "invalid-char-in-name" which is now "not-allowed-char-in-name".

    Acknowledgements

    Thanks to our community for staying with us this whole time and for contribution to make Robocop even better! Special thanks to users that helped with this release:

    • @MoreFamed for suggestion to improve messages of some rules (#500)
    • @d-biehl for reporting a bug about Gherkin being not fully supported by Robocop (#549)
    • @bithium for creating PR that improved how configuration is loaded (#512)
    • @MalikMlitat for adding new W0319 rule that detects deprecated keywords (#565)

    And I (@mnojek) would like to dedicate a huge thank you to @bhirsz who is constantly working on making the tool better. You are awesome! :tada:

    Source code(tar.gz)
    Source code(zip)
  • 1.12.0(Oct 25, 2021)

    This small but impactful release addresses the way Robocop deals with the configuration files. And it was fully implemented by our community! After this change all configuration files will be loaded by default (and not only when calling robocop without any options or paths). Configuration from command line will extend loaded configuration. This will allow to have configuration file with all configuration (excluded, included, format etc.) and still being able to run robocop on single source with robocop test.robot.

    Features

    • always load configuration files (.robocop and .pyproject.toml) #511

    Acknowledgements

    Thanks @bithium for creating & implementing the issue.

    Source code(tar.gz)
    Source code(zip)
  • 1.11.2(Sep 15, 2021)

    Fix for parsing configuration files with non-ASCII characters.

    Fixes

    • Robocop should now parse configuration file with non-ASCI characters (#492)
    Source code(tar.gz)
    Source code(zip)
  • 1.11.1(Sep 13, 2021)

    Fix for parsing invalid keyword call syntax inside if statement.

    Fixes

    • Robocop should now work properly with incorrectly defined keyword calls inside IF statements (#488)
    Source code(tar.gz)
    Source code(zip)
  • 1.11.0(Sep 12, 2021)

    Yet another big release in a row ๐Ÿš€. This time around we bring you 14 new rules - and we finally reached over 100 rules! Most of them try to analyze possible syntax errors and hint you what you possibly did wrong - e.g. if you forgot to put at least 2 spaces after setting. We also included various fixes and improvements for issue reporting.

    Unfortunately, there are backward-incompatible changes - E0304, missing-whitespace-after-setting, variable-should-left-aligned and invalid-char-in-name were renamed (details in the release notes).

    BTW This week is Robocop's first anniversary ๐ŸŽ‚! What a journey it was - nearly 500 issues on GitHub, 20 releases, over 100 implemented rules, over 340 tests and thousands lines of code. Let the Robocop's watch never ends ๐Ÿ‘ฎโ€โ™‚๏ธ!

    New rules

    • W0318 (bdd-without-keyword-call) checks if BDD-reserved keyword was used (Given, When, And, Then, But) with no keyword following it (#159)
    Given  # throws warning
    Given  Some Keyword  # throws warning. Popular mistake - separating action keyword from BDD keyword
    Given Some Keyword 
    
    • E0811 (duplicated-argument-name) for duplicated argument names. This type of error is silently ignored during execution but leads to unexpected results (#401)
    *** Keywords ***
    Keyword
        [Arguments]    ${var}    ${var}
        Log  ${var}
    
    • I0812 (duplicated-assigned-var-name) looks for duplicated names of assigned variables (#480)
    ${var}  ${var}  ${Var}   My Keyword
    
    • E0404 (variables-import-with-args) is reported when using variable imports with arguments when resource extension does not allow it (#435)
    *** Settings ***
    Variables  other.py    arg1  # it's fine
    Variables  variables.robot    arg  # not allowed
    
    • W1015 (misaligned-continuation-row) for alignment of multiline statements (#438)
        Keyword Call
          ...  ${correct}
          ...     ${incorrect}
    
    • E0412 (invalid-for-loop) for invalid FOR loop syntax (#445)
    • E0413 (invalid-if) for invalid IF statement syntax (#483 #439)
    • E0405 (invalid-continuation-mark) for invalid syntax of continuation line (.. value or .... value) (#483 #439)
    • E0407 (invalid-argument) for invalid syntax of argument (for example [Arguments] 1 string instead of variable name) (#483 #439)
    • E0408 (not-existing-setting) when trying to use setting with not recognized name ([Idontexist]) (#483 #439)
    • E0409 (setting-not-supported) when using setting not available in given type of body - for example [Arguments] in Test Case or [Template] in keyword) (#483 #439)
    • E0410 (not-enough-whitespace-after-variable) for example ${variable} 1 (which will not be recognized as proper variable by Robot) instead of ${variable}ย ย 1 (#483 #439)
    • E0411 (not-enough-whitespace-after-suite-setting) for example Library BuiltIn (not recognized by Robot) instead of Libraryย ย BuiltIn (#463)
    • E1016 (suite-setting-should-be-left-aligned) because settings are not recognized if they are not left aligned (#462)
    *** Settings ***
        Library  Collections
    

    Backward-incompatible changes

    • Renamed E0304 rule id to E0406 (name not-enough-whitespace-after-newline-marker did not change). Additionally, this rule catches a lot more instances of this issue
    • Renamed missing-whitespace-after-setting to not-enough-whitespace-after-setting
    • Renamed variable-should-left-aligned to variable-should-be-left-aligned (#478)
    • Rule invalid-char-in-name is renamed to not-allowed-char-in-name. It now accepts a regex pattern as value of configurable (which is renamed from invalid_chars to pattern) and it checks if the name of keyword/test case/suite complies with the regex. (#466) Example of usage:
    robocop -c not-allowed-char-in-name:pattern:[.?%]      # reports when one of `.`, `?` or `%` character is found in the name
    robocop -c not-allowed-char-in-name:pattern:[^a-zA-Z]  # reports when there are characters different then provided in the regex (note the `^` that negates the match)
    

    Fixes

    • Rule W0807 (duplicated-variables-import) now correctly recognizes arguments passed to variable import (#434)
    *** Settings ***
    Variables  vars.py  arg1
    Variables  vars.py  arg2  # it's not considered duplicate now
    
    • Rule W0301 (invalid-char-in-name) now correctly ignores all type of variables in keyword name (including patterns in embedded vars) (#457)
    • Files using different encoding (such as Czech or Slovak language) should be now correctly parsed by Robocop (#455)
    • Variable definition with not enough whitespace after variable name will now be properly recognized and will not be reported as other issues (#464)
    • Not enough whitespace after new line mark (...) is now ignored by other rules such as duplicated-variable (#460)
    • All possible parsing errors should now be reported (#461)
    • Loaded configuration from will not be printed if the configuration is empty (#446)

    Other

    • Rule W0508 (line-too-long) now ignores lines matching configured pattern. Default pattern is http(s) links (#348) It can be configured: robocop -c line-too-long:ignore_pattern:your\s+regex\s+pattern <path_to_tests>
    • Robocop now parses Robot Framework DataError instead of reporting it directly as parsing-error. It allows us to give more detailed information about errors (for example when missing whitespace after setting) (#439)
    • Revised and improved reported issue position (line and column) for all rules. Now it's consistent and also more precise for some of the issues (#289)
    • Changed how duplication rules are reported - instead of reporting on each duplicated line, it now reports on original (but it points to original in duplicated message) (#482) Multiple keywords with name "Duplicated Keyword" (first occurrence in line 15)
    • Robocop source code is now formatted with black (#485)

    Acknowledgements

    Thanks @MoreFamed for bug issues

    Source code(tar.gz)
    Source code(zip)
  • 1.10.0(Sep 1, 2021)

    This huge release introduces 7 new rules and fixes other. Robot Framework 4.1 ๐Ÿค– is now supported. Some great features for developers โŒจ๏ธ like tox are also something new. It also improves the quality of the code ๐Ÿ’ป and documentation ๐Ÿ“„. Thanks to all the contributors for their work! ๐Ÿค Take a look at the details below and have fun using Robocop! ๐Ÿ‘ฎ๐Ÿปโ€โ™‚๏ธ

    Remember to upgrade your Robocop with:

    pip install -U robotframework-robocop
    

    New rules

    • E0314 (empty-library-alias) checks if alias for library (after WITH NAME) is left empty: (#185)
    Library      Collections    WITH NAME
    
    • W0315 (duplicated-library-alias) if alias for library is the same as the library original name: (#185)
    Library      Collections    WITH NAME    Collections
    
    • W0527 (too-many-test-cases) checks if the number of test cases does not exceed the configured number. (#112) This can be easily set by configuring the rule, e.g.: robocop -c too-many-test-cases:max_testcases:100 -c too-many-test-cases:max_templated_testcases:200 <path_to_tests> Defaults are:
      • 50 test cases for a file (suite)
      • 100 templated test cases for a file (suite)
    • I0912 (empty-variable) detects variables without a value (#294)
    • I0913 (can-be-resource-file) suggests to change file extension to .resource if there are no tests defined inside (#380)
    • I0316 (possible-variable-overwriting) detects possible overwriting of variables that are visually similar but are totally the same as read by Robot Framework parser (#120)
    • I0317 (hyphen-in-variable-name) detects hyphens (-) in variable names when assigning values to prevent from accidental subtraction of values (#271)

    Features

    • Listing rules (with --list or --list-configurables options) now also displays a nice summary with amount of rules for each severity: (#416)
    (...)
    Altogether 6 rule(s) with following severity:
        1 error rule(s),
        2 warning rule(s),
        3 info rule(s).
    
    • Added support for Robot Framework 4.1: (#433)
      • Support for new special tags (#449)
      • Support for this syntax ${var}['key']['key2'] (#451)

    Fixes

    • Fixed a lot of typos in code, output and documentation (#418, #419)
    • semicolon : is now allowed to use when configuring rule, e.g. invalid-char-in-name with configurable invalid_chars (#428)
    • Rule W1007 (uneven-indent) now properly parses indentation with templated test cases and comments (#375)
    • Rule W1003 (empty-lines-between-sections) now supports comments between sections (#448)
    • Rule W0301 (invalid-char-in-name) now doesn't break on embedded arguments (#421)
    • Rules W0701 (todo-in-comment) and W0702 (missing-space-after-comment) now accept more cases when using comments (#447)
    • Robocop disablers should now work properly (More info: #425)

    Other

    • Removed deprecation warnings for old rules that were renamed: (#418)
      • setting-name-not-capitalized -> setting-name-not-in-title-case,
      • not-capitalized-keyword-name -> wrong-case-in-keyword-name,
      • missing-doc-testcase -> missing-doc-test-case
    • Some refactor improving readability of the code and its performance (#418, #419)
    • Bug template for GitHub issue is now improved (#426)
    • Block disablers can now be indented (#431)
    • Added pyyaml and tox to dev dependencies in setup.py
    • With introduction of tox, when contributing to codebase, you can now quickly run all tests just by running tox command for both 3 and 4 versions of Robot Framework or you can choose specific one by typing tox -e rf3 or tox -e rf4

    Acknowledgements

    Thanks @MoreFamed, @haklir, @adrszad for reporting bugs and features. Thanks @UliSei, @matusaurio for contributing with comments and suggestions.

    Source code(tar.gz)
    Source code(zip)
  • 1.9.0(Aug 16, 2021)

    Small improvements to file configurations handling and other fixes. You can now also import external rules from Python packages/modules:

    robocop --ext-rules pythonmodule
    

    Features

    • External rules can be imported from external python packages. Read https://robocop.readthedocs.io/en/latest/external_rules.html for more details #404
    • Comments are now supported in arguments files #406
    • section-out-of-order rule can be now configured with custom order of sections #384

    Fixes

    • Empty lines in argument files can be now used #405
    • Fix issue with configuring severity of rule #402

    Other

    • toml module is now installed together with robocop for default support for pyproject.toml file

    Acknowledgements

    Thanks for @fdaguin and @MoreFamed for reported issues and ideas

    Source code(tar.gz)
    Source code(zip)
  • 1.8.1(Jul 21, 2021)

  • 1.8.0(Jul 18, 2021)

    A lot of new rules and changes - with huge number of contributions from others! ๐Ÿš€ Some of the rules change names - see next section for more details.

    Rule names changes

    • Rename missing-doc-testcase to missing-doc-test-case
    • Rename not-capitalized-keyword-name to wrong-case-in-keyword-name
    • Rename setting-name-not-capitalized to setting-name-not-in-title-case

    Features

    • New rule for empty keyword or test case name (E0312 keyword-name-is-empty and E0313 test-case-name-is-empty) #337
    • New rule W1012 consecutive-empty-lines checking for more than consecutive_empty_lines = 1 empty lines #365
    • New rule W1013 empty-lines-in-statement checking for empty lines inside multi line statement #371
    • Tag rules now also parse tags defined in last line of documentation #194
    • New rule E0403 missing-keyword-name for calling variables without keyword name #386
    • New rule E1014 variable-should-left-aligned for ensuring that variables in variables section are left aligned #293

    Fixes

    • Enforce utf-8 encoding when reading file for RawCheckers to fix problems with different encodings (such as inccorectly calculcated length of line) #356
    • Fix invalid documentation regarding configuring format of the message #368
    • W1004 empty-lines-between-test-cases should now ignore templated tests #367
    • E0801 duplicated-test-case should now work correctly with normalized names #376
    • Robocop will now not show W1003 empty-lines-between-sections after keyword section if the number of lines is correct #382
    • format can be now used in .robocop configuraton file #387

    Other

    • When using invalid rule name Robocop will now throw exception listing close matches (if any) #358 #361
    • Allow to check only first word for capitalization in W0302 (wrong-case-in-keyword-name) #359
    • Documentation improvements #385

    Acknowledgements

    Special thanks for:

    • @rauttiz for reporting issues with line length checker
    • @MoreFamed that provided enhancement idea for our error handling and idea for optional configuration for 0302 rule
    • @bollwyvl for including our license inside our package
    • @d-biehl that dicovered issues when parsing test cases and keywords without name and also reported & fixed #376
    • @rdagum that reported issue invalid documentation for rule name inside format option and suggested ignoring some of the issues when parsing code with templated tests
    • @kvo-harmoney for idea of rule checking for consecutive empty lines
    • @yo-ga for adding parsing tags from last line of documentation and implementing rule for checking if variables inside variables section are left aligned
    • @j3n5h for reporting & fixing issue with detecting number of empty lines after keyword section
    • @Calletje234 for reporting issue with configuring format of output message in config file
    Source code(tar.gz)
    Source code(zip)
  • 1.7.1(Apr 13, 2021)

    This is mostly a bugfix release with minor changes to configurables and a big refactor in documentation.

    Fixes

    • Fixed typos and outdated parts in documentation, rephrased some parts #338
    • Fixed typos in description of the rules #338
    • Different line endings are now properly supported when using Robocop API #342
    • Fixed issues with line-too-long (W0508) rule: #349
      • Hidden characters do not count towards line length limit #345
      • Tabulators are now properly counted #346
      • Disablers in comment are excluded from line length limit #347

    Other

    • Better and more concise display of configurable parameters (now they also have some description and show the default value) #338 #350
    • Removed 'checkers' section in documentation and moved some parts under 'rules' section #338

    Acknowledgements

    Thanks @d-biehl for resolving issue with line endings!

    Source code(tar.gz)
    Source code(zip)
  • 1.7.0(Apr 8, 2021)

    This release is mostly a big refactoring with parts of the code not touched since the very first commits. Some defaults has changed, some documentation has been updated. We made couple of fixes also and deprecated rule W0906 that is now exchanged with two new ones: W0909 and W0910. README is now written in markdown and it has a new expandable FAQ section at the bottom. There is also a new verbose mode and pyproject.toml is now supported for tool configuration. These and many more are described in detail below. Enjoy! ๐Ÿ‘ฎ๐Ÿปโ€โ™‚๏ธ

    New rules

    • W0909 (inconsistent-assignment) checks if all assignments in *** Test Cases *** and *** Keywords *** sections are the same type #295
    • W0910 (inconsistent-assignment-in-variables) checks if all assignments in *** Variables *** section are the same type #295

    Note: Possible values for W0909 and W0910 assignment_sign_type parameter are: none (without equal sign), equal_sign ('='), space_and_equal_sign (' ='), autodetect (detects the most common option and looks for inconsistencies in the code).

    • W0705 (bom-encoding-in-file) checks if robot file uses not supported BOM (Byte Order Mark) encoding #327
    • W0911 (wrong-import-order) checks if builtin libraries are imported before any other library #313

    Deprecated rules

    • W0906 (redundant-equal-sign) - with the addition of W0909 and W0910 the W0906 is being deprecated. You can get the old W0906 behavior with W0909 and W0910 if you configure their parameter assignment_sign_type with one of: equal_sign ('='), none (''), space_and_equal_sign (' ='). W0906 will be deleted in next bigger release (1.8.0) or in the following (1.9.0) if it will be too early. #321

    Fixes

    • W1002 (missing-trailing-blank-line) will not report each time when used with LSP #307
    • Misaligned variables in *** Variables *** section should not cause fatal exception now #292
    • Empty keyword names causing TypeError exception #318
    • W0302 (not-capitalized-keyword-name) should have better support for local characters #314
    • W0704 (ignored-data) now works with BOM encoded files #326
    • Changed outdated data in documentation #335
    • For loops and IFs inside test cases should be parsed by indent rules #331
    • W1007 (uneven-indent) will now ignore comments between test cases and keywords #332
    • Empty test case name will not throw IndexError from now #333

    Other

    • README has been rewritten to markdown and now includes nice FAQ section #335
    • Video of our talk from RoboCon2021 is now included at the top of README file! #335
    • pyproject.toml is now supported #301 See documentation for more info docs
    • Severity is not listed in every rule when using --list-configurables, instead it's listed only once #304
    • --list-configurables now displays only rules that have configurable parameter #335
    • Prettified --list-reports output #335
    • severity parameter in other CLI options is now case-insensitive (both e/w/i and E/W/I are accepted) #335
    • Rule name is now included in default issue output #310
    • Added -vv / --verbose flag for more detailed output #72 #335
    • Return status is now calculated on number of found issues that exceed quality gates limits #335
    • Quality gates default values are now {'E': 0, 'W': 0, 'I': -1} which means that any error or warning will make Robocop return non-zero status. -1 value means that issues with INFO severity will not affect return code. This can be configured by --configure return_status:quality_gate:E=<value>:W=<value>:I=<value #335
    • Changed defaults for some lengths checkers: #335
      • testcase_max_calls: 8 โ†’ 10 (maximum amount of keyword calls inside test case)
      • keyword_max_calls: 8 โ†’ 10 (maximum amount of keyword calls inside keyword)
      • keyword_min_calls: 2 โ†’ 1 (minimum amount of keyword calls inside keyword)
    • --ext_rules option is now --ext-rules option (changed underscore _ to hyphen -) #335
    • Some command line options received short flag argument: #335
      • -nr for --no-recursive
      • -lc for --list-configurables
      • -lr for --list-reports
      • -ft for --filetypes
      • -g for --ignore

    Acknowledgements

    • Thanks @d-biehl for fixing #333 and #318 - you're true hero!๐Ÿฆธโ€โ™‚๏ธ
    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Mar 25, 2021)

    Pack of fixes.

    Fixes

    • file_stats will acknowledge issues excluded by configuration #299
    • W1007 (uneven-indent) should not report comments as rule volations #296
    • W1007 (uneven-indent) should parse IFs #297
    • Robocop API should load configuration file #302
    • If there is invalid configuration while using Robocop API, it will throw InvalidArgumentError instead of SystemExit #303
    Source code(tar.gz)
    Source code(zip)
  • 1.6.0(Mar 24, 2021)

    This release introduce initial support for integration with LSP. It makes possible to integrate Robocop with IDEs like Intellij and should enable us to add Robocop to other tools or plugins.

    New rules

    • W1011 (misaligned-continuation) checks if continuation marks ... are aligned with starting row #285

    Fixes

    • W1007 (uneven-indent) should now work better with pipe style #284

    Other

    • Extended our API for easier integration with other tools #168
    Source code(tar.gz)
    Source code(zip)
  • 1.5.0(Mar 15, 2021)

    This release brings few small improvements and fixes critical issues that occur when using Robot Framework 4.0.

    New rules

    • E0311 (else-not-upper-case) checks if ELSE and ELSE IF branches in IF block are upper case #278

    Fixes

    • W1006 (mixed-tabs-and-spaces) should be able to report more than one rule violation per run #274
    • W1007 (uneven-indent) should now support IF blocks #274
    • E0303 (keyword-name-is-reserved-word) will not throw exception when there is only comment in the line #274

    Other

    • New report file_stats can display overall statistics about number of processed files #262
    • You can now use # noqa as alternative to # robocop: disable #269
    • 10% performance improvement thanks to #129
    Source code(tar.gz)
    Source code(zip)
  • 1.4.1(Mar 1, 2021)

  • 1.4.0(Mar 1, 2021)

    This release brings new rules and features that help to uphold the law. It also prepares Robocop for new Robot Framework 4.0 release which will help fighting with new hordes of evil.

    New rules

    • W1010 (too-many-trailing-blank-lines) - Checks if there are too many blank lines at the end of the file #250
    • W0906 (redundant-equal-sign) - Detects redundant equal sign in variable section #265
    • W0308 (not-capitalized-test-case-title) - Checks if test case title starts with capital letter #267
    • W0309 (section-variable-not-uppercase) - Variables in variable section should be uppercase #268
    • W0310 (non-local-variables-should-be-uppercase) - Test, suite and global variables should be uppercased #268
    • I0908 (if-can-be-used) - Suggests that Run Keyword If and Run Keyword Unless can be now changed to new IF statements #259

    Fixes

    • W0302 (not-capitalized-keyword-name) now supports numbers inside keyword names #249
    • W0306 (setting-name-not-capitalized) can detect all not capitalized settings for keyword and test case #266

    Other

    • Robocop now supports Robot Framework 4.0 #258 #254
    • Robocop can now export results to JSON using new JsonReport #251
    • Command line arguments can now be loaded from .robocop file #253
    • New command line option --list-reports that displays all available reports #263
    • Two rules are disabled when using RF4.0: nested-for-loop and invalid-comment

    Acknowledgements

    • Thanks to @andreagubellini for help with exporting rules #251
    Source code(tar.gz)
    Source code(zip)
  • 1.3.2(Jan 20, 2021)

  • 1.3.1(Dec 3, 2020)

  • 1.3.0(Nov 25, 2020)

    Another rule joined our justice department! And two small improvements.

    • ignored-data rule - check if there is data before first section #243
    • mixed-tabs-and-spaces is now approx. 8 times faster #236
    • new report scan_timer that prints how much time it took for scan to complete

    Acknowledgements

    Source code(tar.gz)
    Source code(zip)
  • 1.2.1(Nov 25, 2020)

  • 1.2.0(Nov 17, 2020)

    Release 1.2.0 resolves mostly about improving quality (by introducing acceptance tests for the rules) but it also adds many fixes and one small feature.

    New rules

    • W1009 (empty-line-after-section) - check if there are empty lines after section header and before any other line (#198)

    Fixes

    • Fix empty-section unnecessary raised for *** Comments *** section (#234)
    • Fix rule for invalid syntax for [Teardown]
    • Fix duplicated name rule for Variables import (it never ran due to typo)
    • Reword too-many-arguments warning text (remove sentence suggesting splitting arguments to new lines) (#224)
    • Fix not-capitalized-keyword-name to ignore special characters (#226)
    • Fix not-capitalized-keyword-name to ignore possible library imports (#214)

    Other

    • Robocop now supports printing relative paths in rule message with {source_rel} (#222)
    • Rules are now ordered in the docs (#217 and #228)
    • Added acceptance testing for all rules (#46)

    Acknowledgements

    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Sep 25, 2020)

    Robocop 1.1.0 introduces new rule, moves existing rule to another group and enhances --list feature. Details:

    Changes to rules

    • Added "mixed-tabs-and-spaces" rule for verifying if file does not contain both tabs and spaces
    • Renamed "ineven-indent" rule to "uneven-indent". Moved "uneven-indent" and "bad-indent" rules from misc to spacing group. This is not backwards compatible change - the rule IDs change from "0904" and "0905" to "1007" and "1008" respectively

    Enhanced --list CLI option

    • Added option to pass glob pattern to --list
    robocop --list some-rule*
    
    • Added --list-configurables option to list rules with their configurable parameters

    Other

    • Updated examples in external-checkers.rst

    Acknowledgements

    Source code(tar.gz)
    Source code(zip)
Owner
marketsquare
Robot Framework Community's shared code repositories
marketsquare
An interpreter for the X1 bytecode.

X1 Bytecode Interpreter The X1 Bytecode is bytecode designed for simplicity in programming design and compilation. Bytecode Instructions push

Thanasis Tzimas 1 Jan 15, 2022
Print a directory tree structure in your Python code.

directory-structure Print a directory tree structure in your Python code. Download You can simply: pip install directory-structure Or you can also: Cl

Gabriel Stork 45 Dec 19, 2022
Performant type-checking for python.

Pyre is a performant type checker for Python compliant with PEP 484. Pyre can analyze codebases with millions of lines of code incrementally โ€“ providi

Facebook 6.2k Jan 07, 2023
Robocop is a tool that performs static code analysis of Robot Framework code.

Robocop Introduction Documentation Values Requirements Installation Usage Example Robotidy FAQ Watch our talk from RoboCon 2021 about Robocop and Robo

marketsquare 132 Dec 29, 2022
A static analysis tool for Python

pyanalyze Pyanalyze is a tool for programmatically detecting common mistakes in Python code, such as references to undefined variables and some catego

Quora 212 Jan 07, 2023
TidyPy is a tool that encapsulates a number of other static analysis tools and makes it easy to configure, execute, and review their results.

TidyPy Contents Overview Features Usage Docker Configuration Ignoring Issues Included Tools Included Reporters Included Integrations Extending TidyPy

Jason Simeone 33 Nov 27, 2022
A static type analyzer for Python code

pytype - ? โœ” Pytype checks and infers types for your Python code - without requiring type annotations. Pytype can: Lint plain Python code, flagging c

Google 4k Dec 31, 2022
CodeAnalysis - Static Code Analysis: a code comprehensive analysis platform

TCA, Tencent Cloud Code Analysis English | ็ฎ€ไฝ“ไธญๆ–‡ What is TCA Tencent Cloud Code A

Tencent 1.3k Jan 07, 2023
An analysis tool for Python that blurs the line between testing and type systems.

CrossHair An analysis tool for Python that blurs the line between testing and type systems. THE LATEST NEWS: Check out the new crosshair cover command

Phillip Schanely 836 Jan 08, 2023
pycallgraph is a Python module that creates call graphs for Python programs.

Project Abandoned Many apologies. I've stopped maintaining this project due to personal time constraints. Blog post with more information. I'm happy t

gak 1.7k Jan 01, 2023
coala provides a unified command-line interface for linting and fixing all your code, regardless of the programming languages you use.

"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." โ€• John F. Woods coala provides a

coala development group 3.4k Jan 02, 2023
Alarmer is a tool focus on error reporting for your application.

alarmer Alarmer is a tool focus on error reporting for your application. Installation pip install alarmer Usage It's simple to integrate alarmer in yo

long2ice 20 Jul 03, 2022
Find dead Python code

Vulture - Find dead code Vulture finds unused code in Python programs. This is useful for cleaning up and finding errors in large code bases. If you r

Jendrik Seipp 2.4k Jan 03, 2023
Pymwp is a tool for automatically performing static analysis on programs written in C

pymwp: MWP analysis in Python pymwp is a tool for automatically performing static analysis on programs written in C, inspired by "A Flow Calculus of m

Static Analyses of Program Flows: Types and Certificate for Complexity 2 Dec 02, 2022
Unbearably fast O(1) runtime type-checking in pure Python.

Look for the bare necessities, the simple bare necessities. Forget about your worries and your strife. โ€” The Jungle Book.

1.4k Dec 29, 2022
Metrinome is an all-purpose tool for working with code complexity metrics.

Overview Metrinome is an all-purpose tool for working with code complexity metrics. It can be used as both a REPL and API, and includes: Converters to

26 Dec 26, 2022
This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

This is a Python program to get the source lines of code (SLOC) count for a given GitHub repository.

Nipuna Weerasekara 2 Mar 10, 2022
๐Ÿฆ” PostHog is developer-friendly, open-source product analytics.

PostHog provides open-source product analytics, built for developers. Automate the collection of every event on your website or app, with no need to send data to 3rd parties. With just 1 click you ca

PostHog 10.3k Jan 01, 2023
A bytecode vm written in python.

CHex A bytecode vm written in python. hex command meaning note: the first two hex values of a CHex program are the magic number 0x01 (offset in memory

1 Aug 26, 2022
Calculator Python Package

Calculator Python Package This is a Calculator Package of Python. How To Install The Package? Install packagearinjoyn with pip (Package Installer Of P

Arinjoy_Programmer 1 Nov 21, 2021