@@ -178,15 +178,67 @@ individual source lines. See :ref:`excluding` for details.
178
178
File patterns
179
179
-------------
180
180
181
- File path patterns are used for include and omit, and for combining path
182
- remapping. They follow common shell syntax:
183
-
184
- - ``* `` matches any number of file name characters, not including the directory
185
- separator.
181
+ File path patterns are used for :ref: `include <config_run_include >` and
182
+ :ref: `omit <config_run_omit >`, and for :ref: `combining path remapping
183
+ <cmd_combine_remapping>`. They follow common shell syntax:
186
184
187
185
- ``? `` matches a single file name character.
188
186
189
- - ``** `` matches any number of nested directory names, including none.
187
+ - ``* `` matches any number of file name characters, not including the directory
188
+ separator. As a special case, if a pattern starts with ``*/ ``, it is treated
189
+ as ``**/ ``, and if a pattern ends with ``/* ``, it is treated as ``/** ``.
190
+
191
+ - ``** `` matches any number of nested directory names, including none. It must
192
+ be used as a full component of the path, not as part of a word: ``/**/ `` is
193
+ allowed, but ``/a**/ `` is not.
190
194
191
195
- Both ``/ `` and ``\ `` will match either a slash or a backslash, to make
192
196
cross-platform matching easier.
197
+
198
+ - A pattern with no directory separators matches the file name in any
199
+ directory.
200
+
201
+ Some examples:
202
+
203
+ .. list-table ::
204
+ :widths: 20 20 20
205
+ :header-rows: 1
206
+
207
+ * - Pattern
208
+ - Matches
209
+ - Doesn't Match
210
+ * - ``a*.py ``
211
+ - | anything.py
212
+ | sub1/sub2/another.py
213
+ - | cat.py
214
+ * - ``sub/*/*.py ``
215
+ - | sub/a/main.py
216
+ | sub/b/another.py
217
+ - | sub/foo.py
218
+ | sub/m1/m2/foo.py
219
+ * - ``sub/**/*.py ``
220
+ - | sub/something.py
221
+ | sub/a/main.py
222
+ | sub/b/another.py
223
+ | sub/m1/m2/foo.py
224
+ - | sub1/anything.py
225
+ | sub1/more/code/main.py
226
+ * - ``*/sub/* ``
227
+ - | some/where/sub/more/something.py
228
+ | sub/hello.py
229
+ - | sub1/anything.py
230
+ * - ``*/sub*/* ``
231
+ - | some/where/sub/more/something.py
232
+ | sub/hello.py
233
+ | sub1/anything.py
234
+ - | some/more/something.py
235
+ * - ``*/*sub/test_*.py ``
236
+ - | some/where/sub/test_everything.py
237
+ | moresub/test_things.py
238
+ - | some/where/sub/more/test_everything.py
239
+ | more/test_things.py
240
+ * - ``*/*sub/*sub/** ``
241
+ - | sub/sub/something.py
242
+ | asub/bsub/more/thing.py
243
+ | code/sub/sub/code.py
244
+ - | sub/something.py
0 commit comments