rstcheck
rstcheck documentation
- Version in MegaLinter: 6.0.0
- Visit Official Web Site
- See How to configure rstcheck rules
- See How to disable rstcheck rules in files
Configuration in MegaLinter
- 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 |
file |
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 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 |
MegaLinter Flavours
This linter is available in the following flavours
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 97 | ||
python | Optimized for PYTHON based projects | 49 |
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 [OPTIONS] FILES...
CLI of rstcheck.
Enabled features: ['Toml']
Pass one ore more rst FILES to check. Can be files or directories if
--recursive is passed too. Pass "-" if you want to read from stdin.
Options:
--config PATH Config file to load. Can be a INI or TOML file
or directory. If a directory is passed it will
be searched for .rstcheck.cfg | pyproject.toml
| setup.cfg. If 'NONE' is passed no config file
is loaded at all.
--warn-unknown-settings Log a WARNING for unknown settings in config
files. Can be hidden via --log-level.
-r, --recursive Recursively search passed directories for RST
files to check.
--report-level LEVEL The report level of the linting issues found.
Valid levels are: INFO | WARNING | ERROR |
SEVERE | NONE. Defaults to INFO. Can be set in
config file.
--log-level LEVEL The log level of the application for
information that is not a linting issue. Valid
levels are: DEBUG | INFO | WARNING | ERROR |
CRITICAL. Defaults to WARNING. [default:
WARNING]
--ignore-directives TEXT Comma-separated-list of directives to add to
the ignore list. Can be set in config file.
--ignore-roles TEXT Comma-separated-list of roles to add to the
ignore list. Can be set in config file.
--ignore-substitutions TEXT Comma-separated-list of substitutions to add to
the ignore list. Can be set in config file.
--ignore-languages TEXT Comma-separated-list of languages for code-
blocks to add to the ignore list. The code in
ignored code-blocks will not be checked for
errors. Can be set in config file.
--ignore-messages REGEX A regular expression to match linting issue
messages against to ignore. Can be set in
config file.
--version
--install-completion Install completion for the current shell.
--show-completion Show completion for the current shell, to copy
it or customize the installation.
--help Show this message 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://megalinter.github.io/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://megalinter.github.io/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.