Skip to content


rst-lint documentation

restructuredtext-lint - GitHub

Configuration in Mega-Linter

Variable Description Default value
RST_RST_LINT_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
RST_RST_LINT_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
RST_RST_LINT_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
RST_RST_LINT_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_RST_LINT_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
RST_RST_LINT_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_RST_LINT_PRE_COMMANDS List of bash commands to run before the linter None
RST_RST_LINT_POST_COMMANDS List of bash commands to run after the linter None
RST_RST_LINT_DISABLE_ERRORS Run linter but consider errors as warnings false
RST_RST_LINT_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

  • rst-lint is called one time by identified file

Example calls

rst-lint myfile.rst

Help content

usage: rst-lint [-h] [--version] [--format {text,json}] [--encoding ENCODING]
                [--level {debug,info,warning,error,severe}]
                [--rst-prolog RST_PROLOG]
                path [path ...]

Lint reStructuredText files. Returns 0 if all files pass linting, 1 for an
internal error, and 2 if linting failed.

positional arguments:
  path                  File/folder to lint

optional arguments:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
  --format {text,json}  Format of the output (default: "text")
  --encoding ENCODING   Encoding of the input file (e.g. "utf-8")
  --level {debug,info,warning,error,severe}
                        Minimum error level to report (default: "warning")
  --rst-prolog RST_PROLOG
                        reStructuredText content to prepend to all files
                        (useful for substitutions)

Installation on mega-linter Docker image

Example success log

Results of rst-lint linter (version 1.3.2)
See documentation on

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

Example error log

Results of rst-lint linter (version 1.3.2)
See documentation on

[ERROR] .automation/test/rst/rst_bad_1.rst
    WARNING .automation/test/rst/rst_bad_1.rst:2 Title underline too short.