cfn-lint icon indicating copy to clipboard operation
cfn-lint copied to clipboard

Configuring exit codes with the parameter `--non-zero-exit-code` is not working

Open JoseRolles opened this issue 1 year ago • 1 comments

CloudFormation Lint Version

cfn-lint 0.66.1

What operating system are you using?

Ubuntu host and running cfn-lint in docker built from repo (docker build --tag cfn-python-lint:latest .)

Describe the bug

I have a template with an unused parameter. Running cfn-lint on the template gives the expected warning W2001 and the exit code is 4. However, when I used the parameter --non-zero-exit-code none or --non-zero-exit-code error, the exist code is still 4.

Expected behavior

According to the documentation, setting none or error should make the exit code 0.

Reproduction template

Template (template.yaml):

Parameters:
  UnusedParameter:
    Type: String
Resources:
  LogGroup:
    Type: AWS::Logs::LogGroup

Commands and output:

$ cfn-lint -t template.yaml
W2001 Parameter UnusedParameter not used.
template.yaml:2:3

$ echo $?
4
$ cfn-lint --non-zero-exit-code none -t template.yaml
W2001 Parameter UnusedParameter not used.
template.yaml:2:3

$ echo $?
4
$ cfn-lint --version
cfn-lint 0.66.1

JoseRolles avatar Apr 05 '24 23:04 JoseRolles

You are using v0.66.1 can you upgrade... we just released v0.86.3 today. My assumption is this has been resolved for a while.

(cfn-python-lint-wusv) ➜  cfn-python-lint git:(main) cfn-lint --non-zero-exit-code none -t local/issue/3136.yaml
W2001 Parameter UnusedParameter not used.
local/issue/3136.yaml:2:3

(cfn-python-lint-wusv) ➜  cfn-python-lint git:(main) echo $?
0

kddejong avatar Apr 15 '24 17:04 kddejong