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_COMMAND_REMOVE_ARGUMENTS | User custom arguments to remove from command line before calling the linter 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- 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_UNSECURED_ENV_VARIABLES | List of env variables explicitly not filtered before calling RST_RST_LINT and its pre/post commands | 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 |
RST_RST_LINT_CLI_EXECUTABLE | Override CLI executable | ['rst-lint'] |
MegaLinter Flavors
This linter is available in the following flavors
Flavor | Description | Embedded linters | Info | |
---|---|---|---|---|
all | Default MegaLinter Flavor | 124 | ||
cupcake | MegaLinter for the most commonly used languages | 83 | ||
python | Optimized for PYTHON based projects | 62 |
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 (
file
CLI lint mode)
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
options:
-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):