Skip to content


rstcheck documentation

rstcheck - GitHub

Configuration in MegaLinter

Variable Description Default value
RST_RSTCHECK_ARGUMENTS User custom arguments to add in linter CLI call
Ex: -s --foo "bar"
RST_RSTCHECK_FILTER_REGEX_INCLUDE Custom regex including filter
Ex: (src\|lib)
Include every file
RST_RSTCHECK_FILTER_REGEX_EXCLUDE Custom regex excluding filter
Ex: (test\|examples)
Exclude no file
RST_RSTCHECK_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_RSTCHECK_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
RST_RSTCHECK_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_RSTCHECK_PRE_COMMANDS List of bash commands to run before the linter None
RST_RSTCHECK_POST_COMMANDS List of bash commands to run after the linter None
RST_RSTCHECK_CONFIG_FILE rstcheck configuration file name
Use LINTER_DEFAULT to let the linter find it
RST_RSTCHECK_RULES_PATH Path where to find linter configuration file Workspace folder, then MegaLinter default rules
RST_RSTCHECK_DISABLE_ERRORS Run linter but consider errors as warnings false
RST_RSTCHECK_DISABLE_ERRORS_IF_LESS_THAN Maximum number of errors allowed 0

IDE Integration

Use rstcheck in your favorite IDE to catch errors before MegaLinter !

IDE Extension Name Install
Visual Studio Code vscode-restructuredtext Install in VsCode

MegaLinter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 97 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

  • rstcheck is called one time by identified file

Example calls

rstcheck myfile.rst
rstcheck -c .rstcheck.cfg myfile.rst

Help content

usage: rstcheck [-h] [--config CONFIG] [-r] [--report level]
                [--ignore-language language] [--ignore-messages messages]
                [--ignore-directives directives]
                [--ignore-substitutions substitutions] [--ignore-roles roles]
                [--debug] [--version]
                files [files ...]

Checks code blocks in reStructuredText.

positional arguments:
  files                 files to check

optional arguments:
  -h, --help            show this help message and exit
  --config CONFIG       location of config file
  -r, --recursive       run recursively over directories
  --report level        report system messages at or higher than level; info,
                        warning, error, severe, none (default: info)
  --ignore-language language, --ignore language
                        comma-separated list of languages to ignore
  --ignore-messages messages
                        python regex that match the messages to ignore
  --ignore-directives directives
                        comma-separated list of directives to ignore
  --ignore-substitutions substitutions
                        comma-separated list of substitutions to ignore
  --ignore-roles roles  comma-separated list of roles to ignore
  --debug               show messages helpful for debugging
  --version             show program's version number and exit

Installation on mega-linter Docker image

Example success log

Results of rstcheck linter (version 3.3.1)
See documentation on

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

Example error log

Results of rstcheck linter (version 3.3.1)
See documentation on

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