rst-lint
rst-lint documentation
- Version in MegaLinter: 1.4.0
- Visit Official Web Site
Configuration in MegaLinter
- Enable rst-lint by adding
RST_RST_LINT
in ENABLE_LINTERS variable - Disable rst-lint by adding
RST_RST_LINT
in DISABLE_LINTERS variable
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_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_RST_LINT_FILE_EXTENSIONS | Allowed file extensions. "*" matches any extension, "" matches empty extension. Empty list excludes all filesEx: [".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_PRE_COMMANDS | List of bash commands to run before the linter | None |
RST_RST_LINT_POST_COMMANDS | List of bash commands to run after the linter | None |
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 |
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
- rst-lint is called one time by identified file
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
- PIP packages (Python):
Example success log
Results of rst-lint linter (version 1.3.2)
See documentation on https://megalinter.github.io/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://megalinter.github.io/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.