Skip to content

rstcheck

GitHub stars GitHub release (latest SemVer) GitHub last commit GitHub commit activity GitHub contributors

rstcheck documentation

rstcheck - GitHub

Configuration in MegaLinter

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
- 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 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_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_UNSECURED_ENV_VARIABLES List of env variables explicitly not filtered before calling RST_RSTCHECK and its pre/post commands 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
RST_RSTCHECK_CLI_EXECUTABLE Override CLI executable ['rstcheck']

IDE Integration

Use rstcheck in your favorite IDE to catch errors before MegaLinter !

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

MegaLinter Flavours

This linter is available in the following flavours

Flavor Description Embedded linters Info
all Default MegaLinter Flavor 113 Docker Image Size (tag) Docker Pulls
cupcake MegaLinter for the most commonly used languages 81 Docker Image Size (tag) Docker Pulls
python Optimized for PYTHON based projects 58 Docker Image Size (tag) Docker Pulls

Behind the scenes

How are identified applicable files

  • File extensions: .rst

How the linting is performed

  • rstcheck is called one time by identified file (file CLI lint mode)

Example calls

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

Help content


 Usage: rstcheck [OPTIONS] FILES...                                             

 CLI of rstcheck.
 Enabled features: []
 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    │
│                                         file or directory. If a directory is │
│                                         passed it will be searched for       │
│                                         .rstcheck.cfg | setup.cfg. If 'NONE' │
│                                         is passed no config file is loaded   │
│                                         at all.                              │
│                                         [default: None]                      │
│ --warn-unknown-settings                 Log a WARNING for unknown settings   │
│                                         in config files. Can be hidden via   │
│                                         --log-level.                         │
│ --recursive              -r             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.                         │
│                                         [default: None]                      │
│ --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.                  │
│                                         [default: None]                      │
│ --ignore-roles                   TEXT   Comma-separated-list of roles to add │
│                                         to the ignore list. Can be set in    │
│                                         config file.                         │
│                                         [default: None]                      │
│ --ignore-substitutions           TEXT   Comma-separated-list of              │
│                                         substitutions to add to the ignore   │
│                                         list. Can be set in config file.     │
│                                         [default: None]                      │
│ --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.   │
│                                         [default: None]                      │
│ --ignore-messages                REGEX  A regular expression to match        │
│                                         linting issue messages against to    │
│                                         ignore. Can be set in config file.   │
│                                         [default: None]                      │
│ --version                                                                    │
│ --help                                  Show this message and exit.          │
╰──────────────────────────────────────────────────────────────────────────────╯

Installation on mega-linter Docker image