Skip to content

rstcheck

rstcheck documentation

rstcheck - GitHub

Configuration in Mega-Linter

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_FILE_EXTENSIONS Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all files
Ex: [".py", ""]
[".rst"]
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_CONFIG_FILE rstcheck configuration file name
Use LINTER_DEFAULT to let the linter find it
.rstcheck.cfg
RST_RSTCHECK_RULES_PATH Path where to find linter configuration file Workspace folder, then Mega-Linter 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 Mega-Linter !

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

Mega-Linter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default Mega-Linter Flavor 91 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 47 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .rst

Example calls

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

Help content

usage: rstcheck [-h] [-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. Sphinx is enabled.

positional arguments:
  files                 files to check

optional arguments:
  -h, --help            show this help message and exit
  -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 https://nvuillam.github.io/mega-linter/descriptors/rst_rstcheck/
-----------------------------------------------

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


Example error log

Results of rstcheck linter (version 3.3.1)
See documentation on https://nvuillam.github.io/mega-linter/descriptors/rst_rstcheck/
-----------------------------------------------

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