You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Even though error codes (e.g. ["E3002"]) are set to be ignored, the errors are still caught. The rule is disabled in RulesCollection. Ignoring checks works correctly with the CLI client.
Here is example code to reproduce the behaviour:
importcfnlintimportcfnlint.coreimportsubprocessimporttempfiledata="""AWSTemplateFormatVersion: 2010-09-09Resources: ECSCluster: Type: AWS::ECS::Cluster Properties: NonExistentProperty: value"""subprocess.run(["cfn-lint", "-v"])
withtempfile.NamedTemporaryFile("w") asf:
f.write(data)
f.flush()
print("CLI result:")
subprocess.run(["cfn-lint", "-i", "E3002", "--", f.name])
template=cfnlint.decode.cfn_yaml.loads(data)
rules=cfnlint.core.get_rules([], ["E3002"], [])
# Disable with 0.x since this doesn't exist.# if rules.is_rule_enabled(rules.rules.get("E3002")):# raise ValueError("E3002 should be disabled")matches=cfnlint.core.run_checks("template.yaml", template, rules, ["us-east-1"])
print("\nPython result:")
print(matches)
The above provides different output with cfn-lint 1.37.7 and 0.87.7:
$ python3 fail_to_ignore.py cfn-lint 0.87.7CLI result:Python result:[]
$ python3 fail_to_ignore.pycfn-lint 1.3.7CLI result:Python result:[[E3002: Resource properties are invalid] (Additional properties are not allowed ('NonExistentProperty' was unexpected)) matched template.yaml:8]
Expected behavior
Error codes provided to cfnlint.core.get_rules() should not result in lint errors.
Reproduction template
AWSTemplateFormatVersion: 2010-09-09Resources:
ECSCluster:
Type: AWS::ECS::ClusterProperties:
NonExistentProperty: value
The text was updated successfully, but these errors were encountered:
Taking a look into this. My first note would be around using the API as we have tried to make some of these integrations easier for you. The API will build the rules for you, decode the file, etc.
Yes, we found the new API as well. Looks like you've already fixed the problem anyway (I tested my example code with the change in place, and it works).
CloudFormation Lint Version
1.3.7
What operating system are you using?
Debian
Describe the bug
Even though error codes (e.g.
["E3002"]
) are set to be ignored, the errors are still caught. The rule is disabled inRulesCollection
. Ignoring checks works correctly with the CLI client.Here is example code to reproduce the behaviour:
The above provides different output with cfn-lint 1.37.7 and 0.87.7:
Expected behavior
Error codes provided to
cfnlint.core.get_rules()
should not result in lint errors.Reproduction template
The text was updated successfully, but these errors were encountered: