Cfn-python-lint: Ignore-checks doesn't work for E000*

Created on 17 Sep 2019  路  7Comments  路  Source: aws-cloudformation/cfn-python-lint

*cfn-lint version: 0.22.3

Ignore Checks isn't working

Template: https://gist.github.com/jeffmacdonald/cbbdd8cc3a049f89dfb4a17991ca1afa

I am getting the following error:

E0000 Expecting value
templates/ssh-jump-host.yaml:1:1

When I run pipenv run cfn-lint --ignore-checks=E0000 templates/ssh-jump-host.yaml

The fun part is, I have I have errors in other templates (E2521) and I am able to ignore those just fine... it seems it's specifically E0000 that doesn't get ignored.

bug

Most helpful comment

@miparnisari let me take a swing at this one. I'll want your opinions on some of this as we go but I think I have an idea or two.

All 7 comments

Agreed some of the E0000-E0005 checks may not be properly skipped when being configured to ignore them. We'll have to add some logic in for some of these generic rules.

Is this still an issue? I'm trying to ignore a check on a specific resource which uses a Transform function. But it is not getting ignore when i use the following;

    Metadata:
      cfn-lint:
        config:
          ignore_checks:
          - E3001
          - E0001

Seeing the same issue with E0000.

Idem here. E0001 won't be ignored.
Tried ignoring in Metadata on Resource, top-level node, and in .cfnlintrc file.

Agreed some of the E0000-E0005 checks may not be properly skipped when being configured to ignore them. We'll have to add some logic in for some of these generic rules.

@kddejong can you expand a bit on why it's failing for that particular subset of rules?

They aren't standard rules. The are errors throw when a rule has an exception, or when the template is malformed, or has a null value, or the template can't be found, etc. I don't think there is any reason they can't be ignored. I think we would need to build in a little bit better logic for those types of errors.

Additional I think there may be a few exceptions we have to figure out how to handle.

  • Metadata based exceptions may not work as expected. For instance, I'm not sure we can put an exception in Metadata to ignore the E0000 code for a null value in the template because we are doing that rule at template parsing time. In which case I never have the Metadata to read to apply the exception.
  • Another one will be if the serverless transform fails. We may be able to ignore the error but we can't really check the rest of the rules with a non transformed template. I'm not sure what our expectation would be in this case.

https://github.com/aws-cloudformation/cfn-python-lint/blob/fe0af928a4ab26a6cedfd76564a26c9a4120b14f/src/cfnlint/rules/__init__.py#L424-L448

E0000 could be ignorable. In the early stages we also had a parameter called --ignore-bad-template which was supposed to help there. Given the feature changes since this parameter was put in we would have probably done this differently.

@miparnisari let me take a swing at this one. I'll want your opinions on some of this as we go but I think I have an idea or two.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KarthickEmis picture KarthickEmis  路  4Comments

adamchainz picture adamchainz  路  4Comments

jecnua picture jecnua  路  5Comments

adamchainz picture adamchainz  路  5Comments

shawnsi picture shawnsi  路  3Comments