diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2022-10-23 14:03:17 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-10-30 15:45:47 -0400 |
commit | ec6205a8de972af6a09453235d02a7ebea6aea8e (patch) | |
tree | 2e55057dff55197a0466d8189c2bac6b2d03239c /doc/source.rst | |
parent | b3a1d979f8625e4974eaa7211cdecb211ba90b50 (diff) | |
download | python-coveragepy-git-ec6205a8de972af6a09453235d02a7ebea6aea8e.tar.gz |
fix: use glob matching instead of fnmatch. #1407
I didn't understand that fnmatch considers the entire string to be a
filename, even if it has slashes in it. This led to incorrect matching.
Now we use our own implementation of glob matching to get the correct
behavior.
Diffstat (limited to 'doc/source.rst')
-rw-r--r-- | doc/source.rst | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/doc/source.rst b/doc/source.rst index cfd0e6fc..64ebd132 100644 --- a/doc/source.rst +++ b/doc/source.rst @@ -59,10 +59,10 @@ removed from the set. .. highlight:: ini -The ``include`` and ``omit`` file name patterns follow typical shell syntax: -``*`` matches any number of characters and ``?`` matches a single character. -Patterns that start with a wildcard character are used as-is, other patterns -are interpreted relative to the current directory:: +The ``include`` and ``omit`` file name patterns follow common shell syntax, +described below in :ref:`source_glob`. Patterns that start with a wildcard +character are used as-is, other patterns are interpreted relative to the +current directory:: [run] omit = @@ -77,7 +77,7 @@ The ``source``, ``include``, and ``omit`` values all work together to determine the source that will be measured. If both ``source`` and ``include`` are set, the ``include`` value is ignored -and a warning is printed on the standard output. +and a warning is issued. .. _source_reporting: @@ -103,3 +103,22 @@ reporting. Note that these are ways of specifying files to measure. You can also exclude individual source lines. See :ref:`excluding` for details. + + +.. _source_glob: + +File patterns +------------- + +File path patterns are used for include and omit, and for combining path +remapping. They follow common shell syntax: + +- ``*`` matches any number of file name characters, not including the directory + separator. + +- ``?`` matches a single file name character. + +- ``**`` matches any number of nested directory names, including none. + +- Both ``/`` and ``\`` will match either a slash or a backslash, to make + cross-platform matching easier. |