Skip to content

rstfmt

formatter

rstfmt documentation

rstfmt - GitHub

Configuration in MegaLinter

Variable Description Default value
RST_RSTFMT_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
RST_RSTFMT_COMMAND_REMOVE_ARGUMENTS User custom arguments to remove from command line before calling the linter
Ex: -s --foo "bar"
RST_RSTFMT_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
RST_RSTFMT_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
RST_RSTFMT_CLI_LINT_MODE Override default CLI lint mode
- file: Calls the linter for each file
- project: Call the linter from the root of the project
file
RST_RSTFMT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".rst"]
RST_RSTFMT_FILE_NAMES_REGEX File name regex filters. Regular expression list for filtering files by their base names using regex full match. Empty list includes all files
Ex: ["Dockerfile(-.+)?", "Jenkinsfile"]
Include every file
RST_RSTFMT_PRE_COMMANDS List of bash commands to run before the linter None
RST_RSTFMT_POST_COMMANDS List of bash commands to run after the linter None
RST_RSTFMT_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling RST_RSTFMT and its pre/post commands None
RST_RSTFMT_DISABLE_ERRORS Run linter but consider errors as warnings true
RST_RSTFMT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0
RST_RSTFMT_CLI_EXECUTABLE Override CLI executable ['rstfmt']

MegaLinter Flavors

This linter is available in the following flavors

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 124 Docker Image Size (tag) Docker Pulls
cupcake MegaLinter for the most commonly used languages 84 Docker Image Size (tag) Docker Pulls
formatters Contains only formatters 17 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 62 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .rst

How the linting is performed

  • rstfmt is called one time by identified file (file CLI lint mode)

Example calls

rstfmt --check myfile.rst
rstfmt myfile.rst

Help content

usage: rstfmt [-h] [--version] [--check] [--diff] [-w WIDTH] [--ext EXT]
              [--test] [-v]
              [path ...]

positional arguments:
  path                  files/directories to run on

options:
  -h, --help            show this help message and exit
  --version             show rstfmt version and exit
  --check               don't update files, but exit with nonzero status if
                        any files are not formatted
  --diff                don't update files, but show a diff of what would
                        change
  -w WIDTH, --width WIDTH
                        the target line length in characters
  --ext EXT             the extension of files to look at when passed a
                        directory (default `rst`)
  --test                [internal] run tests instead of updating files
  -v, --verbose         [internal] print extra debugging information

Installation on mega-linter Docker image

  • PIP packages (Python):