Code autoformatter for Robot Framework
Project description
Robotidy
Introduction
Robotidy is spiritual descendant of Robot Framework’s robot.tidy package. Its main purpose is to format Robot Framework code according to agreed code standards. You can run Robotidy without configuring anything but you can also change how it behaves through CLI or configuration file.
Requirements
Python 3.7+ and Robot Framework 4.0.0+.
Installation
You can install Robotidy by running:
pip install git+git://github.com/MarketSquare/robotframework-tidy
Usage
When called without any arguments, robotidy will not do anything. It requires at least one argument: source to file/directory with robot files:
robotidy tests robotidy test.robot robotidy tests/resources test.robot
Executing selected transformers
You can run robotidy with selected transformers. Use --transform argument for this:
robotidy --transform ReplaceRunKeywordIf src
Some transformers provide configurable parameters. You can modify them by adding : after transformer name:
robotidy --transform DiscardEmptySections:allow_only_comments=True src
It is possible to develop your own transformers. You can use module name (if it is installed in your env) or path to file with class:
robotidy --transform MyTransformers.YourCustomTransformer --transform C:\transformers\YourCustomTransformer2.py src
Command line options
You can list available options by running robotidy --help:
Usage: robotidy [OPTIONS] [PATH(S)] Options: --transform TRANSFORMER_NAME Transform files from [PATH(S)] with given transformer --overwrite / --no-overwrite Overwrite source files. --diff Output diff of each processed file. -s, --spacecount INTEGER The number of spaces between cells in the plain text format. Default is 4. -l, --lineseparator [native|windows|unix] Line separator to use in outputs. The default is 'native'. native: use operating system's native line separators windows: use Windows line separators (CRLF) unix: use Unix line separators (LF) -p, --usepipes Use pipe ('|') as a column separator in the plain text format. -sl, --startline INTEGER Limit robotidy only to selected area. If --endline is not provided, format text only at --startline. Line numbers start from 1. -el, --endline INTEGER Limit robotidy only to selected area. Line numbers start from 1. -v, --verbose --config FILE Read configuration from FILE path. --list-transformers List available transformers and exit. --describe-transformer TRANSFORMER_NAME Show documentation for selected transformer. --version Show the version and exit. --help Show this message and exit.
Configuration file
- Robotidy can read configuration from files with toml type. Options are loaded in following order:
auto-discovered configuration file (robotidy.toml)
configuration file passed with --config
command line arguments
By default if --config argument is not used, robotidy look for configuration file named robotidy.toml in common directories for passed sources and execution directory.
It is possible to mix configuration between config file and command line, but if the same parameters are used command line parameter value will be used instead (reference to loading order). It’s important because you cannot specify some of the transformers in config file and come in CLI - you need to list all required transformers in one place.
Example configuration file:
[main] overwrite = false diff = false spacecount = 4 [transformers] [transformers.DiscardEmptySections] allow_only_comments = true [transformers.ReplaceRunKeywordIf]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file robotframework-tidy-0.0.1.tar.gz
.
File metadata
- Download URL: robotframework-tidy-0.0.1.tar.gz
- Upload date:
- Size: 27.0 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 799f21a9d6b5b88a7cd0a91466549e6c53e54797168ca251440f24a50562682d |
|
MD5 | 20c83cd48301fdf29ec2a10e72b110c7 |
|
BLAKE2b-256 | 80b70d67a2b782d6a6c624d4cf09fc4867a5a4945aed2041dfc6805b5291bcc6 |
Provenance
File details
Details for the file robotframework_tidy-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: robotframework_tidy-0.0.1-py3-none-any.whl
- Upload date:
- Size: 41.5 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23f23dd2ad9770b0d7d2cf94a5b9d3c19f3bd7ae154331a946adbcc0485ff93a |
|
MD5 | fa49c41e4d215250200b70c859737869 |
|
BLAKE2b-256 | 0daa89e5a410cdc4d7f5a2f9ba112eb5469b613dde104c9afe1fe841ae85d30c |