Skip to content


rstfmt documentation

rstfmt - GitHub

Configuration in Mega-Linter

Variable Description Default value
RST_RSTFMT_ARGUMENTS User custom arguments to add in linter CLI call
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
- list_of_files: Call the linter with the list of files as argument
- project: Call the linter from the root of the project
RST_RSTFMT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
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_DISABLE_ERRORS Run linter but consider errors as warnings true
RST_RSTFMT_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 94 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 49 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

Example calls

rstfmt --check myfile.rst
rstfmt myfile.rst

Help content

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

positional arguments:
  path                  files/directories to run on

optional arguments:
  -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
  -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

Example success log

Results of rstfmt linter (version 0.0.0)
See documentation on

[SUCCESS] .automation/test/rst_rstfmt/rst_good_1.rst