aws-cloudformation / cfn-lint

CloudFormation Linter
MIT No Attribution
2.43k stars 586 forks source link

Need to use platform-specific path separator in ignore_templates #2729

Open coyoteecd opened 1 year ago

coyoteecd commented 1 year ago

CloudFormation Lint Version

0.77.4

What operating system are you using?

Windows

Describe the bug

On my Windows dev PC, I cannot use / as path separator for the ignore_templates entries in .cfnlintrc. Using the OS-specific \ works, however it then breaks when running cfn-lint on our Ubuntu build machine.

This is different from behavior of templates section where I can use / as path separator and it works fine on both operating systems.

Expected behavior

I expect ignore_templates to accept paths with / as separator on both Windows and Linux-based OSes. The .cfnlintrc file shown below should work and correctly ignore excluded.yml file:

templates:
- resources/**/*.yml
ignore_templates:
- resources/excluded.yml

Reproduction template

No template necessary, this is a config issue

kddejong commented 1 year ago

agreed on this one. I need to investigate it but this should work the same way.

whoDoneItAgain commented 1 year ago

i can confirm this behavior as well. running win11 0.77.5.

I have to add both variations to my ignore_templates section to get it to properly ignore while the templates section only has the forward slash

kddejong commented 4 months ago

I took some time to look into this today. So here is what I think... when sending in a /**/ on Windows to the glob it will return the windows normalized names. However, if you have a fully hardcoded name it will just send it back. I think the best solution here is to normalize all the paths to windows based structure. That's what the PR above does.