# Buggy code
def match(self, cfn):
    """Check CloudFormation Resources"""

    matches = []

    for r_name, r_values in cfn.get_resources().items():
        update_policy = r_values.get("UpdatePolicy", {})
        resource_type = r_values.get("Type")
        if isinstance(update_policy, dict):
            for up_type, up_value in update_policy.items():
                path = ["Resources", r_name, "UpdatePolicy", up_type]
                up_type_spec = self.valid_attributes.get("main").get(up_type)
                if up_type_spec:
                    if resource_type not in up_type_spec.get("ResourceTypes"):
                        message = "UpdatePolicy only supports this type for resources of type ({0})"
                        matches.append(
                            RuleMatch(
                                path,
                                message.format(
                                    ", ".join(
                                        map(str, up_type_spec.get("ResourceTypes"))
                                    )
                                ),
                            )
                        )
                    if "Type" in up_type_spec:
                        matches.extend(
                            self.check_attributes(
                                up_value, up_type_spec.get("Type"), path[:]
                            )
                        )

                    else:
                        matches.extend(
                            self.check_primitive_type(
                                up_value,
                                up_type_spec.get("PrimitiveType"),
                                path[:],
                                valid_values=up_type_spec.get("ValidValues", []),
                            )
                        )
                else:
                    message = "UpdatePolicy doesn't support type {0}"
                    matches.append(RuleMatch(path, message.format(up_type)))
        else:
            message = "UpdatePolicy should be an object"
            matches.append(
                RuleMatch(
                    ["Resources", r_name, "UpdatePolicy"], message.format(path[-1])
                )
            )

    return matches


# Traceback (AssertionError)
FAIL: test_file_negative_alias (rules.resources.updatepolicy.test_configuration.TestConfiguration)
Test failure
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/cmmeyer/Documents/DevAdvocate/cfn-python-lint/test/rules/resources/updatepolicy/test_configuration.py", line 37, in test_file_negative_alias
self.helper_file_negative('fixtures/templates/bad/resources/updatepolicy/config.yaml', 10)
File "/Users/cmmeyer/Documents/DevAdvocate/cfn-python-lint/test/rules/__init__.py", line 52, in helper_file_negative
self.assertEqual(err_count, len(errs))
AssertionError: 10 != 1

# Fixed code
def match(self, cfn):
    """Check CloudFormation Resources"""

    matches = []

    for r_name, r_values in cfn.get_resources().items():
        update_policy = r_values.get("UpdatePolicy", {})
        resource_type = r_values.get("Type")
        if isinstance(update_policy, dict):
            for up_type, up_value in update_policy.items():
                path = ["Resources", r_name, "UpdatePolicy", up_type]
                up_type_spec = self.valid_attributes.get("main").get(up_type)
                if up_type_spec:
                    if resource_type not in up_type_spec.get("ResourceTypes"):
                        message = "UpdatePolicy only supports this type for resources of type ({0})"
                        matches.append(
                            RuleMatch(
                                path,
                                message.format(
                                    ", ".join(
                                        map(str, up_type_spec.get("ResourceTypes"))
                                    )
                                ),
                            )
                        )
                    if "Type" in up_type_spec:
                        matches.extend(
                            self.check_attributes(
                                up_value, up_type_spec.get("Type"), path[:]
                            )
                        )

                    else:
                        matches.extend(
                            self.check_primitive_type(
                                up_value,
                                up_type_spec.get("PrimitiveType"),
                                path[:],
                                valid_values=up_type_spec.get("ValidValues", []),
                            )
                        )
                else:
                    message = "UpdatePolicy doesn't support type {0}"
                    matches.append(RuleMatch(path, message.format(up_type)))
        else:
            message = "UpdatePolicy should be an object"
            matches.append(
                RuleMatch(["Resources", r_name, "UpdatePolicy"], message.format())
            )

    return matches