Style Checks
This extension is capable of checking several style rules in configurable manner and hooks itself up into the regular Sphinx build process. It’s triggered by Sphinx as soon as all documents have been discovered and filtered. Hence, only changed documents will be checked.
Built-In Checks
The following checks are included and enabled by default:
Whitespaces
trailing_whitespacesTrailing whitespaces are not allowed.
Heading Syntax
heading_levelsEnforces the style of heading underline characters.underline_lengthHeadline underline length must match the length of the headline itself.
Top-Level Headings
top_level_headingAll documents must have a top-level heading.top_level_lengthTop-level heading must not exceed a configurable maximum length.top_level_modulenameThe top-level heading in index.rst of modules must start with the module name.top_level_casingModule name in top-level heading must match the module name in terms of capitalization.
Include Directives
include_rstIncludes must not point to an*.rstfile
Usage
To use the dox_style extension just register it in conf.py.
Configuration
To configure the checks, specify the stylecheck variable in conf.py.
Only non-default values need to be specified.
The full list of options including defaults can be obtained by running
python -m dox_style
from within the extension repository.
Global Options
Excluding files from all checks:
'exclude': [<list of glob patterns>] # default: []
Defining how many lines of context above/below the finding are show
'excerpt': 4 # default: 2
Check-Specific Options
Each check has its own key in the stylecheck variable and features at least the following
options for globally disabling this check and to exclude certain files from this particular check:
'trailing_whitespaces': {'enabled': True, 'exclude': []}
All checks are enabled by default and their exclusion list is empty.
Examples
This is an example configuration:
stylecheck = {
'exclude': ['**/gptp/**'],
'excerpt': 2,
'trailing_whitespaces': {'exclude': ['**/3rdparty/**']},
'top_level_length': {'limit': 40},
'top_level_modulename': {'enabled': False}
}
To disable all checks, use this configuration:
stylecheck = {
'exclude': ['*'],
}