Skip to content

rst-lint

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_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".rst"]
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_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 84 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 44 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .rst

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 https://nvuillam.github.io/mega-linter/descriptors/rst_rst_lint/
-----------------------------------------------

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


Example error log

Results of rst-lint linter (version 1.3.2)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/rst_rst_lint/
-----------------------------------------------

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