@ -44,6 +44,11 @@ class SimpleConfigTestCase(unittest.TestCase):
with self.assertRaises(config.YamlLintConfigError):
config.YamlLintConfig('not: valid: yaml')
def test_is_file_ignored_allows_none(self):
c = config.YamlLintConfig('ignore: foobar\n')
self.assertTrue(c.is_file_ignored('foobar'))
self.assertFalse(c.is_file_ignored(None))
def test_unknown_rule(self):
with self.assertRaisesRegex(
config.YamlLintConfigError,
@ -45,7 +45,7 @@ class YamlLintConfig:
self.validate()
def is_file_ignored(self, filepath):
return self.ignore and self.ignore.match_file(filepath)
return self.ignore and filepath and self.ignore.match_file(filepath)
def is_yaml_file(self, filepath):
return self.yaml_files.match_file(os.path.basename(filepath))