- """
- Read in each .yaml or .env file. If it is successfully parsed as yaml, save
- contents, else add filename to list of bad yaml files. Log the result of
- parse attempt.
- """
- conf = YamlLintConfig("rules: {}")
+ if path.splitext(filename)[-1].lower() not in (".yml", ".yaml", ".env"):
+ pytest.skip("Not a YAML file")
+ try:
+ load_yaml(filename)
+ except YAMLError as e:
+ assert False, (
+ "Invalid YAML detected: {} "
+ "NOTE: Online YAML checkers such as yamllint.com "
+ "can helpful in diagnosing errors in YAML"
+ ).format(str(e).replace("\n", " "))