Skip to main content

Linter for Robot Framework

Project description

Unit tests

robocop-logo

Robocop

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

Values

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

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.1+.

Installation

You can install Robocop simply by running:

pip install 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

Main features

  • including/excluding rules from command line with the support for glob patterns:

    --include *missing* -i W0507 --exclude rule,rule2 -e *doc*
  • disabling rules directly from source code

    Ignoring rules in one line:

    This is Keyword  # robocop: disable=not-capitalized-keyword-name

    Ignoring all rules or selected ones:

    Log  ${var}
    Log  ${var}  # robocop: disable
    log  ${var}  # robocop: disable=0301,0302

    Ignoring whole blocks or even files:

    # robocop: disable=unnecessary-default-tags,0102
    *** Settings ***
    Library  RobotLibrary.py
    
    # robocop: enable=0102
  • filtering out all rules below given severity level:

    --threshold E
  • customized format of output message:

    --format {source}:{line}:{col} [{severity}] {rule_id} {desc}
  • configurable return status for every severity level:

    --configure return_status:quality_gate:E=2:W=39
  • generating customized reports:

    --reports rules_by_id,rules_by_error_type
    
    Issues by ids:
    W0902 (ineven-indent)                : 5
    E0904 (nested-for-loop)              : 4
    W0302 (not-capitalized-keyword-name) : 4
    
    Found 12 issue(s): 9 WARNING(s), 4 ERROR(s).
  • configurable lint rules:

    --configure 0507:line_length:100 -c ineven-indent:severity:W
  • external rules support:

    --ext_rules path/to/your/rules.py -rules supports_many_paths.py
  • output redirection to file:

    --output robocop.log
  • loading arguments from file:

    --argumentfile jenkins_args.txt
  • configurable scanned filetypes:

    --filetypes .txt,.rst
  • paths matching pattern can be ignored:

    --ignore *.robot,resources/* --ignore special_file.txt

Documentation

Full documentation available here.

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

Project details


Download files

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

Source Distribution

robotframework-robocop-1.0.0.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

robotframework_robocop-1.0.0-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file robotframework-robocop-1.0.0.tar.gz.

File metadata

  • Download URL: robotframework-robocop-1.0.0.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3

File hashes

Hashes for robotframework-robocop-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d1ad26eda4c53683199689979476acbc8202c876b43eeb2158df88c2782ee5cf
MD5 ac843c946d7e483e8bc9a389130be470
BLAKE2b-256 b6b7df705569560971c4e5ec97fa244aea7993fde1c0dd9b9091a0d4d31922b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: robotframework_robocop-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.49.0 CPython/3.8.3

File hashes

Hashes for robotframework_robocop-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb3ccbaac4e7da162770fa7b7880605031a9b8089dce04d3c12dd6e8f7c5d458
MD5 f28c501839c1ef4fcb8c48072acc483a
BLAKE2b-256 49b6c3f798a7e47e40ef12e9b816fc579810e574e482bfa5c4de6f6a3864f77b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page