Skip to content

Commit e21ddbf

Browse files
authored
stubtest: improve allowlist documentation (#15008)
Could help with e.g. matplotlib/matplotlib#24976
1 parent 0f09be4 commit e21ddbf

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/source/stubtest.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,29 @@ The rest of this section documents the command line interface of stubtest.
122122
allowlists. Allowlists can be created with --generate-allowlist. Allowlists
123123
support regular expressions.
124124

125+
The presence of an entry in the allowlist means stubtest will not generate
126+
any errors for the corresponding definition.
127+
125128
.. option:: --generate-allowlist
126129

127130
Print an allowlist (to stdout) to be used with --allowlist
128131

132+
When introducing stubtest to an existing project, this is an easy way to
133+
silence all existing errors.
134+
129135
.. option:: --ignore-unused-allowlist
130136

131137
Ignore unused allowlist entries
132138

139+
Without this option enabled, the default is for stubtest to complain if an
140+
allowlist entry is not necessary for stubtest to pass successfully.
141+
142+
Note if an allowlist entry is a regex that matches the empty string,
143+
stubtest will never consider it unused. For example, to get
144+
`--ignore-unused-allowlist` behaviour for a single allowlist entry like
145+
``foo.bar`` you could add an allowlist entry ``(foo\.bar)?``.
146+
This can be useful when an error only occurs on a specific platform.
147+
133148
.. option:: --mypy-config-file FILE
134149

135150
Use specified mypy config file to determine mypy plugins and mypy path

0 commit comments

Comments
 (0)