When defining a pyproject.toml with the exclude option, and not understanding that it must be a list, people (me) write things like:
[tool.diff_cover]
exclude = "some/file.py"
Because strings are iterable, this ends up here, calling fnmatch() on each item in ['s', 'o', 'm', 'e', '/', 'f', 'i', 'l', 'e', '.', 'p', 'y'].
Very confusing.
And when you include a * that ends up always excluding everything, which make you think you've succeeded, when in fact you just entirely disabled the tool.
I think that it should either be an error to pass a plain string, or perhaps more helpfully adding if isinstance(patterns, str): patterns = [patterns], allowing both exclude = "string" and exclude = ["strings"].
When defining a pyproject.toml with the
excludeoption, and not understanding that it must be a list, people (me) write things like:Because strings are iterable, this ends up here, calling
fnmatch()on each item in['s', 'o', 'm', 'e', '/', 'f', 'i', 'l', 'e', '.', 'p', 'y'].Very confusing.
And when you include a
*that ends up always excluding everything, which make you think you've succeeded, when in fact you just entirely disabled the tool.I think that it should either be an error to pass a plain string, or perhaps more helpfully adding
if isinstance(patterns, str): patterns = [patterns], allowing bothexclude = "string"andexclude = ["strings"].