rstcheck
rstcheck documentation
- Version in Mega-Linter: 3.3.1
- Visit Official Web Site
- See How to configure rstcheck rules
- See How to disable rstcheck rules in files
Configuration in Mega-Linter
- Enable rstcheck by adding
RST_RSTCHECK
in ENABLE_LINTERS variable - Disable rstcheck by adding
RST_RSTCHECK
in DISABLE_LINTERS variable
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 |
{linter.cli_lint_mode} |
RST_RSTCHECK_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".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_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 nameUse 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 |
Mega-Linter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default Mega-Linter Flavor | 93 | ||
python | Optimized for PYTHON based projects | 48 |
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] [-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
- PIP packages (Python):
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.