Skip to content

Commit 5e441da

Browse files
authored
Merge pull request matplotlib#26737 from story645/rst-linter
MNT: pre-commit rst linter + small linting fixes
2 parents b8a42cf + 4f7d68f commit 5e441da

28 files changed

+162
-78
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ repos:
2626
- id: no-commit-to-branch #default is master and main
2727
- id: trailing-whitespace
2828
exclude_types: [svg]
29-
3029
- repo: https://github.com/pycqa/flake8
3130
rev: 6.0.0
3231
hooks:
@@ -44,10 +43,15 @@ repos:
4443
"--skip",
4544
"doc/users/project/credits.rst"
4645
]
47-
4846
- repo: https://github.com/pycqa/isort
4947
rev: 5.12.0
5048
hooks:
5149
- id: isort
5250
name: isort (python)
5351
files: ^galleries/tutorials/|^galleries/examples/|^galleries/plot_types/
52+
- repo: https://github.com/rstcheck/rstcheck
53+
rev: v6.2.0
54+
hooks:
55+
- id: rstcheck
56+
additional_dependencies:
57+
- sphinx>=1.8.1

doc/_templates/autofunctions.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ Functions
1414
.. autosummary::
1515
:template: autosummary.rst
1616
:toctree:
17+
1718
{% for item in functions %}{% if item not in ['plotting', 'colormaps'] %}
1819
{{ item }}{% endif %}{% endfor %}
20+
1921
{% endif %}
2022
{% endblock %}

doc/_templates/automodule.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{{ fullname | escape | underline}}
22

33
{% if fullname in ['mpl_toolkits.axes_grid1.colorbar'] %}
4-
.. To prevent problems with the autosummary for the colorbar doc
5-
treat this separately (sphinx-doc/sphinx/issues/4874)
4+
5+
.. To prevent problems with the autosummary for the colorbar doc treat this
6+
separately (sphinx-doc/sphinx/issues/4874)
7+
68
.. automodule:: {{ fullname }}
79
:members:
810

@@ -21,8 +23,10 @@ Classes
2123
.. autosummary::
2224
:template: autosummary.rst
2325
:toctree:
26+
2427
{% for item in classes %}{% if item not in ['zip', 'map', 'reduce'] %}
2528
{{ item }}{% endif %}{% endfor %}
29+
2630
{% endif %}
2731
{% endblock %}
2832

@@ -38,6 +42,7 @@ Functions
3842

3943
{% for item in functions %}{% if item not in ['zip', 'map', 'reduce'] %}
4044
{{ item }}{% endif %}{% endfor %}
45+
4146
{% endif %}
4247
{% endblock %}
4348
{% endif %}

doc/_templates/autosummary.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
{% if objtype in ['class'] %}
8+
89
.. auto{{ objtype }}:: {{ objname }}
910
:show-inheritance:
1011
:special-members: __call__
@@ -16,11 +17,13 @@
1617

1718
{% if objtype in ['class', 'method', 'function'] %}
1819
{% if objname in ['AxesGrid', 'Scalable', 'HostAxes', 'FloatingAxes',
19-
'ParasiteAxesAuxTrans', 'ParasiteAxes'] %}
20+
'ParasiteAxesAuxTrans', 'ParasiteAxes'] %}
21+
2022
.. Filter out the above aliases to other classes, as sphinx gallery
2123
creates no example file for those (sphinx-gallery/sphinx-gallery#365)
2224
2325
{% else %}
26+
2427
.. minigallery:: {{module}}.{{objname}}
2528
:add-heading:
2629

doc/_templates/autosummary_class_only.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
{% if objtype in ['class'] %}
8+
89
.. auto{{ objtype }}:: {{ objname }}
910
:no-members:
1011

doc/api/next_api_changes/behavior/25775-HZ.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Default antialiasing behavior changes for ``Text`` and ``Annotation``
44
``matplotlib.pyplot.annotate()`` and ``matplotlib.pyplot.text()`` now support parameter *antialiased* when initializing.
55
Examples:
66

7-
.. code-block::
7+
.. code-block:: python
88
99
mpl.text.Text(.5, .5, "foo\nbar", antialiased=True)
1010
plt.text(0.5, 0.5, '6 inches x 2 inches', antialiased=True)

doc/api/prev_api_changes/api_changes_2.1.2.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ list of conditions was incomplete, didn't handle RGB tuples,
1212
didn't handle linewidths or linestyles etc.
1313

1414
This logic did not exist in `.axes.Axes.legend`. It was included (erroneously)
15-
in Matplotlib 2.1.1 when the legend argument parsing was unified
16-
[#9324](https://github.com/matplotlib/matplotlib/pull/9324). This change
17-
removes that check in `.axes.Axes.legend` again to restore the old behavior.
15+
in Matplotlib 2.1.1 when the legend argument parsing was unified :ghpull:`9324`.
16+
This change removes that check in `.axes.Axes.legend` again to restore the old
17+
behavior.
1818

1919
This logic has also been dropped from `.Figure.legend`, where it
2020
was previously undocumented. Repeated

doc/api/prev_api_changes/api_changes_3.5.0/behaviour.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ consistently exposes all the attributes and methods related to the line marker
132132
(:ghissue:`11358`). This makes it easy to change the marker features after
133133
instantiating a legend.
134134

135-
.. code::
135+
.. code-block:: python
136136
137137
import matplotlib.pyplot as plt
138138
@@ -147,7 +147,7 @@ instantiating a legend.
147147
The former legend handler for Line2D objects has been renamed
148148
`.HandlerLine2DCompound`. To revert to the previous behaviour, one can use
149149

150-
.. code::
150+
.. code-block:: python
151151
152152
import matplotlib.legend as mlegend
153153
from matplotlib.legend_handler import HandlerLine2DCompound

doc/api/prev_api_changes/api_changes_3.7.0/behaviour.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Now, the halfrange remains fixed when vcenter is changed, and **vmin** and
5151

5252
For example, this is what the values were when changing vcenter previously.
5353

54-
.. code-block::
54+
.. code-block:: python
5555
5656
norm = CenteredNorm(vcenter=0, halfrange=1)
5757
# Move vcenter up by one
@@ -61,7 +61,7 @@ For example, this is what the values were when changing vcenter previously.
6161
6262
and now, with that same example
6363

64-
.. code-block::
64+
.. code-block:: python
6565
6666
norm = CenteredNorm(vcenter=0, halfrange=1)
6767
norm.vcenter = 1

doc/devel/MEP/MEP23.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ This is and may continue to be the desired method of operation for
3434
most use cases.
3535

3636
Sometimes when there are too many figures open at the same time, it is
37-
desirable to be able to group these under the same window
38-
[see](https://github.com/matplotlib/matplotlib/issues/2194).
37+
desirable to be able to group these under the same window. See :ghpull:`2194`.
38+
3939

4040
The proposed solution modifies `.FigureManagerBase` to contain and manage more
4141
than one ``Canvas``. The settings parameter :rc:`backend.multifigure` control
@@ -44,7 +44,7 @@ when the **MultiFigure** behaviour is desired.
4444
**Note**
4545

4646
It is important to note, that the proposed solution, assumes that the
47-
[MEP22](https://github.com/matplotlib/matplotlib/wiki/Mep22) is
47+
`MEP22 <https://github.com/matplotlib/matplotlib/wiki/Mep22>`_. is
4848
already in place. This is simply because the actual implementation of
4949
the ``Toolbar`` makes it pretty hard to switch between canvases.
5050

0 commit comments

Comments
 (0)