Skip to content

Commit 426d958

Browse files
committedSep 6, 2024
Bug 1917163 - Update rstcheck to 6.2.4, fix resulting errors in documents, r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D221287
1 parent ff67222 commit 426d958

File tree

23 files changed

+227
-81
lines changed

23 files changed

+227
-81
lines changed
 

‎.rstcheck.cfg

+24-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,25 @@
1+
# Reference: https://rstcheck.readthedocs.io/en/latest/usage/config/#ini-format
12
[rstcheck]
2-
# See: https://rstcheck.readthedocs.io/en/latest/usage/config/#ini-format
3-
# Note that the version used in mozilla-central is behind, so not all options
4-
# are available.
5-
#
6-
ignore_language=cpp,json
7-
ignore_messages=(No Pygments lexer found for "none".)
3+
# This list might be simplified when https://github.com/rstcheck/rstcheck-core/issues/68
4+
# is fixed.
5+
ignore_directives=
6+
autoclass,
7+
autoexception,
8+
automethod,
9+
automodule,
10+
digraph,
11+
dropdown,
12+
graph,
13+
graphviz,
14+
js,
15+
js:autoclass,
16+
js:autofunction,
17+
mermaid,
18+
ignore_languages =
19+
cpp,
20+
json,
21+
ignore_messages=(Duplicate explicit target name: "(.*)"|Enumerated list start value not ordinal\-1: "\d" \(ordinal \d\)|Hyperlink target ".*" is not referenced\.|No Pygments lexer found for "none"\.)
22+
ignore_roles =
23+
js,
24+
ref,
25+
searchfox,

‎browser/components/urlbar/docs/.rstcheck.cfg

-13
This file was deleted.

‎build/docs/defining-xpcom-components.rst

+4
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ Class Constructors
208208
This simplest way to define a component is to include a header defining a
209209
concrete type, and let the component manager call that class's constructor:
210210

211+
.. rstcheck: ignore-languages=python
211212
.. code-block:: python
212213
213214
'type': 'mozilla::foo::Foo',
@@ -226,6 +227,7 @@ returns the same instance on subsequent calls. This requires declaring the
226227
constructor in an included header, and implementing it in a separate source
227228
file:
228229

230+
.. rstcheck: ignore-languages=python
229231
.. code-block:: python
230232
231233
'type': 'mozilla::foo::Foo',
@@ -255,6 +257,7 @@ External Constructors
255257
For types whose headers can't easily be included, constructors can be defined
256258
using a template specialization on an incomplete type:
257259

260+
.. rstcheck: ignore-languages=python
258261
.. code-block:: python
259262
260263
'type': 'mozilla::foo::Foo',
@@ -281,6 +284,7 @@ Registering Categories
281284
Classes which need define category entries with the same value as their
282285
contract ID may do so using the following:
283286

287+
.. rstcheck: ignore-languages=python
284288
.. code-block:: python
285289
286290
'contract_ids': ['@mozilla.org/foo;1'],

‎build/docs/mozbuild-symbols.rst

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
mozbuild Sandbox Symbols
55
========================
66

7+
.. rstcheck: ignore-directives=mozbuildsymbols
78
.. mozbuildsymbols:: mozbuild.frontend.context

‎build/docs/test_manifests.rst

+1
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ See
198198
`the source <https://hg.mozilla.org/mozilla-central/file/default/testing/mozbase/manifestparser/manifestparser/manifestparser.py>`_ for the full documentation of the
199199
expression syntax until it is documented here.
200200

201+
.. rstcheck: ignore-directives=todo
201202
.. todo::
202203

203204
Document manifest filter language.

‎devtools/docs/user/devtoolsapi/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -669,6 +669,7 @@ ToolSidebar
669669

670670
To build a sidebar in your tool, first, add a xul:tabbox where you want the sidebar to live:
671671

672+
.. rstcheck: ignore-languages=xml
672673
.. code-block:: xml
673674
674675
<splitter class="devtools-side-splitter"/>

‎docs/bug-mgmt/guides/status-flags.rst

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,24 @@
11
Release Status Flags
22
====================
33

4-
The flag ``status_firefoxNN`` has many values, here’s a cheat sheet.
4+
The flag ``status_firefoxN`` has many values, here’s a cheat sheet.
55

6-
== ========== ========== ============ =================
7-
— ? unaffected affected fixed
8-
== ========== ========== ============ =================
9-
? unaffected wontfix verified
10-
\ affected fix-optional disabled
11-
\ fixed verified disabled
12-
== ========== ========== ============ =================
6+
+---------+------------+------------+--------------+-------------------+
7+
| \-\-\- | \? | unaffected | affected | fixed |
8+
+=========+============+============+==============+===================+
9+
| \? | unaffected | | wontfix | verified |
10+
+---------+------------+------------+--------------+-------------------+
11+
| | affected | | fix-optional | disabled |
12+
+---------+------------+------------+--------------+-------------------+
13+
| | | | fixed | verified disabled |
14+
+---------+------------+------------+--------------+-------------------+
1315

1416
The headers of the table are values of the status flag. Each column are
1517
the states reachable from the column headings.
1618

1719
- ``---`` we don’t know whether Firefox N is affected
1820
- ``?`` we don’t know whether Firefox N is affected, but we want to find
19-
out.
21+
out
2022
- ``affected`` - present in this release
2123
- ``unaffected`` - not present in this release
2224
- ``fixed`` - a contributor has landed a change set in the tree

‎intl/l10n/docs/fluent/index.rst

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Fluent
33
======
44

5-
`Fluent`_ is a localization system developed by Mozilla, which aims to replace
6-
all existing localization models currently used at Mozilla.
5+
`Fluent <http://projectfluent.org/>`__ is a localization system developed by
6+
Mozilla, which aims to replace all existing localization models currently used
7+
at Mozilla.
78

89
In case of Firefox it directly supersedes DTD and StringBundle systems, providing
910
a large number of features and improvements over both of them, for developers
@@ -21,5 +22,3 @@ Other resources:
2122
* `Fluent Wiki <https://github.com/projectfluent/fluent/wiki>`_
2223
* `Fluent.js Wiki <https://github.com/projectfluent/fluent.js/wiki>`_
2324
* `Fluent DOM L10n Tutorial <https://projectfluent.org/dom-l10n-documentation/>`_
24-
25-
.. _Fluent: http://projectfluent.org/

‎mobile/android/docs/geckoview/contributor/geckoview-architecture.rst

+1
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ be declared in GeckoView's ``AndroidManifest.xml``.
392392

393393
For example, this is the definition of the ``media`` process:
394394

395+
.. rstcheck: ignore-languages=xml
395396
.. code-block:: xml
396397
397398
<service

‎mobile/android/docs/geckoview/contributor/geckoview-quick-start.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ To view the javadoc locally, choose one of the two options:
326326

327327
.. code:: bash
328328
329-
cd <path_of_javadoc_from_above>
329+
cd path_of_javadoc_from_above
330330
331331
Now, we want to launch a local web server. To launch locally, use any web server, for example:
332332

‎python/mach/docs/commands.rst

+15-13
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,13 @@ The important decorators are as follows:
3535

3636
Here is a complete example:
3737

38+
.. rstcheck: ignore-languages=python
3839
.. code-block:: python
3940
40-
from mach.decorators import (
41-
CommandArgument,
42-
Command,
43-
)
41+
from mach.decorators import (
42+
CommandArgument,
43+
Command,
44+
)
4445
4546
@Command('doit', help='Do ALL OF THE THINGS.')
4647
@CommandArgument('--force', '-f', action='store_true',
@@ -77,19 +78,20 @@ why the command cannot currently be run.
7778

7879
Here is an example:
7980

81+
.. rstcheck: ignore-languages=python
8082
.. code-block:: python
8183
82-
from mach.decorators import (
83-
Command,
84-
)
84+
from mach.decorators import (
85+
Command,
86+
)
8587
86-
def build_available(cls):
87-
"""The build needs to be available."""
88-
return cls.build_path is not None
88+
def build_available(cls):
89+
"""The build needs to be available."""
90+
return cls.build_path is not None
8991
90-
@Command('run_tests', conditions=[build_available])
91-
def run_tests(command_context):
92-
# Do stuff here.
92+
@Command('run_tests', conditions=[build_available])
93+
def run_tests(command_context):
94+
# Do stuff here.
9395
9496
By default all commands without any conditions applied will be runnable,
9597
but it is possible to change this behaviour by setting

‎python/mozbuild/mozbuild/vendor/docs/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ to interact with it.
2727
Template ``moz.yaml`` file
2828
==========================
2929

30+
.. rstcheck: ignore-languages=yaml
3031
.. code-block:: yaml
3132
3233

‎testing/condprofile/README.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,9 @@ and they provide four keys:
100100
In the example below, we install uBlock, set a pref, and pass the
101101
**max_urls** option to the **heavy** scenario.
102102

103-
{
103+
.. code-block:: json
104+
105+
{
104106
"name": "intermediate",
105107
"addons":{
106108
"uBlock":"https://addons.mozilla.org/firefox/downloads/file/3361355/ublock_origin-1.21.2-an+fx.xpi"

‎testing/mozbase/docs/manifestparser.rst

+1
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ that can be applied to the `TestManifest`. To do so, add the filter to `TestMani
306306
:members:
307307
:exclude-members: filterlist,InstanceFilter,DEFAULT_FILTERS
308308

309+
.. rstcheck: ignore-directives=autodata
309310
.. autodata:: manifestparser.filters.DEFAULT_FILTERS
310311
:annotation:
311312

‎testing/mozbase/docs/mozproxy.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@ Mozproxy is used by Raptor to run performance test without having to interact
1111
with the real web site.
1212

1313
Mozproxy provide a function that returns a playback class. The usage pattern is
14-
::
14+
15+
.. rstcheck: ignore-languages=python
16+
.. code-block:: python
1517
1618
from mozproxy import get_playback
1719

‎testing/mozharness/docs/mozharness.mozilla.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ mozharness.mozilla.blob_upload module
2222
:show-inheritance:
2323

2424
mozharness.mozilla.automation module
25-
----------------------------------
25+
------------------------------------
2626

2727
.. automodule:: mozharness.mozilla.automation
2828
:members:

‎toolkit/components/telemetry/docs/collection/scalars.rst

+1
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ definition file.
116116

117117
The probes in the definition file are represented in a fixed-depth, two-level structure:
118118

119+
.. rstcheck: ignore-languages=yaml
119120
.. code-block:: yaml
120121
121122
# The following is a category.

‎toolkit/modules/docs/AsyncShutdown.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ The shutdown of a process takes place by phase, such as:
237237

238238
- ``profileBeforeChange`` (once this phase is complete, there is no guarantee that the process has access to a profile directory);
239239
- ``webWorkersShutdown`` (once this phase is complete, JavaScript does not have access to workers anymore);
240-
- ...
240+
-
241241

242242
Much as services, phases have clients. For instance, all users of web workers MUST have finished using their web workers before the end of phase ``webWorkersShutdown``.
243243

‎tools/lint/rst/__init__.py

+7-14
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,6 @@
3939
)
4040

4141
RSTCHECK_FORMAT_REGEX = re.compile(r"(.*):(.*): \(.*/([0-9]*)\) (.*)$")
42-
IGNORE_NOT_REF_LINK_UPSTREAM_BUG = re.compile(
43-
r"Hyperlink target (.*) is not referenced."
44-
)
4542

4643

4744
def setup(root, **lintargs):
@@ -69,6 +66,8 @@ def get_rstcheck_binary():
6966

7067
def parse_with_split(errors):
7168
match = RSTCHECK_FORMAT_REGEX.match(errors)
69+
if not match:
70+
return None
7271
filename, lineno, level, message = match.groups()
7372

7473
return filename, lineno, level, message
@@ -81,15 +80,10 @@ def lint(files, config, **lintargs):
8180
paths = list(paths)
8281
chunk_size = 50
8382
binary = get_rstcheck_binary()
84-
# rstcheck configuration is stored in `/.rstcheck.cfg`. The `ignore-roles`
85-
# directive remains in this file as it doesn't have effect when declared in
86-
# the config file.
87-
rstcheck_options = [
88-
"--ignore-roles=searchfox",
89-
]
9083

9184
while paths:
92-
cmdargs = [which("python"), binary] + rstcheck_options + paths[:chunk_size]
85+
# Config for rstcheck is stored in `/.rstcheck.cfg`.
86+
cmdargs = [which("python"), binary] + paths[:chunk_size]
9387
log.debug("Command: {}".format(" ".join(cmdargs)))
9488

9589
proc = subprocess.Popen(
@@ -102,10 +96,9 @@ def lint(files, config, **lintargs):
10296
all_errors = proc.communicate()[1]
10397
for errors in all_errors.split("\n"):
10498
if len(errors) > 1:
105-
filename, lineno, level, message = parse_with_split(errors)
106-
if not IGNORE_NOT_REF_LINK_UPSTREAM_BUG.match(message):
107-
# Ignore an upstream bug
108-
# https://github.com/rstcheck/rstcheck-core/issues/4
99+
split_result = parse_with_split(errors)
100+
if split_result:
101+
filename, lineno, level, message = split_result
109102
res = {
110103
"path": filename,
111104
"message": message,

‎tools/lint/rst/requirements.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ snowballstemmer==2.2.0
1212
sphinxcontrib-applehelp==1.0.4
1313
sphinxcontrib-htmlhelp==2.0.1
1414
sphinxcontrib-mermaid==0.9.2
15-
rstcheck==3.5.0
15+
rstcheck==6.2.4
1616
Pygments==2.14.0
1717
pytz==2022.7.1
1818
urllib3==1.26.9

0 commit comments

Comments
 (0)
Failed to load comments.