From e6c890b1d3122d6340601473b4cefc0a00697199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Thu, 16 Mar 2023 21:19:30 +0100 Subject: [PATCH] linter: Prevent testing is_file_ignored() with filepath == None As reported in https://github.com/adrienverge/yamllint/pull/548, there might be a problem with pathspec 0.11.1 which does't allow calling `match_file()` with argument `None` anymore. The `linter.run()` function shouldn't call `YamlLintConfig.is_file_ignored(None)` anyway. --- yamllint/linter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yamllint/linter.py b/yamllint/linter.py index cf30cdf7..5501bb59 100644 --- a/yamllint/linter.py +++ b/yamllint/linter.py @@ -223,7 +223,7 @@ def run(input, conf, filepath=None): :param input: buffer, string or stream to read from :param conf: yamllint configuration object """ - if conf.is_file_ignored(filepath): + if filepath is not None and conf.is_file_ignored(filepath): return () if isinstance(input, (bytes, str)):