File tree Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -515,6 +515,7 @@ jobs:
515
515
- pre-commit
516
516
- metadata-validation
517
517
- build-docs
518
+ - codelinter-docs
518
519
- coverage-docs
519
520
- doctest-docs
520
521
- linkcheck-docs
Original file line number Diff line number Diff line change 87
87
lock-file-env :
88
88
- build-dists
89
89
- build-docs
90
+ - codelinter-docs
90
91
- coverage-docs
91
92
- doctest-docs
92
93
- linkcheck-docs
@@ -106,6 +107,8 @@ jobs:
106
107
lock-file-extra-input : pyproject.toml
107
108
- lock-file-env : build-docs
108
109
lock-file-extra-input : ' '
110
+ - lock-file-env : codelinter-docs
111
+ lock-file-extra-input : ' '
109
112
- lock-file-env : coverage-docs
110
113
lock-file-extra-input : ' '
111
114
- lock-file-env : doctest-docs
Original file line number Diff line number Diff line change @@ -6,4 +6,6 @@ Sphinx # main docs framework
6
6
sphinx-autodoc-typehints # gets function param types from annotations
7
7
sphinx-issues # Sphinx roles providing support for linking GitHub
8
8
sphinx-tabs # Sphinx directives providing support for HTML tabs
9
+ sphinxawesome-codelinter # lints snippets of embedded code
9
10
sphinxcontrib-apidoc # automatic API pages generator
11
+ yamllint # called by `sphinxawesome-codelinter`
Original file line number Diff line number Diff line change
1
+ build-docs.in
Original file line number Diff line number Diff line change 76
76
'sphinx_autodoc_typehints' , # gets function param types from annotations
77
77
'sphinx_issues' , # implements `:issue:`, `:pr:` and other GH-related roles
78
78
'sphinx_tabs.tabs' ,
79
+ 'sphinxawesome.codelinter' , # checks code blocks with linters
79
80
'sphinxcontrib.apidoc' ,
80
81
81
82
# In-tree extensions:
135
136
typehints_use_signature = True
136
137
typehints_use_signature_return = True
137
138
139
+ # -- Options for sphinxawesome.codelinter extension --------------------------
140
+
141
+ codelinter_languages = {
142
+ 'json' : 'python -Im json.tool' ,
143
+ 'yaml' : 'python -Im yamllint -' ,
144
+ }
145
+
138
146
# -- Options for sphinxcontrib.apidoc extension ------------------------------
139
147
140
148
apidoc_excluded_paths = []
Original file line number Diff line number Diff line change @@ -398,6 +398,40 @@ pass_env =
398
398
READTHEDOCS* # Present @ RTD
399
399
400
400
401
+ [testenv:codelinter-docs]
402
+ allowlist_externals =
403
+ {[testenv:build-docs]allowlist_externals}
404
+ description = Lint code snippets in docs
405
+ changedir = {[testenv:build-docs]changedir}
406
+ commands_pre =
407
+ # Retrieve possibly missing commits:
408
+ -git fetch --unshallow
409
+ -git fetch --tags
410
+
411
+ # Clean up sphinxcontrib-apidoc generated RST files:
412
+ -git clean -x -f -- ' pkg{/}*.rst'
413
+ commands =
414
+ {envpython} \
415
+ {[python-cli-options]byte-errors} \
416
+ {[python-cli-options]max-isolation} \
417
+ {[python-cli-options]warnings-to-errors} \
418
+ -m sphinx \
419
+ -j auto \
420
+ {tty:--color} \
421
+ -a \
422
+ -n \
423
+ -W --keep-going \
424
+ -b codelinter \
425
+ -d ' {temp_dir}{/}.doctrees' \
426
+ . \
427
+ {posargs:{envtmpdir}{/}codelinter}
428
+ commands_post =
429
+ deps =
430
+ -r{toxinidir}{/}dependencies{/}direct{/}{envname}.in
431
+ pass_env =
432
+ {[testenv:build-docs]pass_env}
433
+
434
+
401
435
[testenv:coverage-docs]
402
436
allowlist_externals =
403
437
{[testenv:build-docs]allowlist_externals}
You can’t perform that action at this time.
0 commit comments