Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'yaml-files' directive not working for directory #390

Closed
andrewimeson opened this issue Jun 11, 2021 · 3 comments
Closed

'yaml-files' directive not working for directory #390

andrewimeson opened this issue Jun 11, 2021 · 3 comments

Comments

@andrewimeson
Copy link
Contributor

yamllint 1.26.1 does not match files in a directory like I expect it to. I have created a PR in my demonstration repo to illustrate the problem, but I'll summarize here.

If I have a YAML file in group_vars/i_am_a_y-a-m-l_file which has no file extension. All files under group_vars/ are assumed to be YAML files, but without extensions. I try and instruct yamllint to treat them as such using a variety of different directives, but none of them result in yamllint checking the file.

file: .yamllint

---
extends: default
ignore: |
  .venv/
  .git/
yaml-files:
  - '*.yaml'
  - '*.yml'
  # This works
  - '*.yamaml'
  # None of these work for matching non ".yml" ".yaml" files in group_vars/
  - group_vars
  - group_vars/
  - /group_vars/
  - ./group_vars/
  - ./group_vars
  - group_vars/*
  - group_vars/**
  - ./group_vars/*
  - ./group_vars/**

file: group_vars/i_am_a_y-a-m-l_file

---
this_file_has_problems: TRUE

file: group_vars/bad.yamaml

# yamllint will lint this file, because of the extension match
# it won't lint it without that, even though it's in a directory that should
# match.
has_problems: TRUE

Running yamllint, it correctly takes on my custom file extension .yamaml (🐬🐻❓), but it doesn't lint i_am_a_y-a-m-l_file

$ yamllint .
./group_vars/bad.yamaml
  4:1       warning  missing document start "---"  (document-start)
  4:15      warning  truthy value should be one of [false, true]  (truthy)
@andrewimeson
Copy link
Contributor Author

andrewimeson commented Jun 11, 2021

I have a workaround git ls-files group_vars/ | xargs yamllint

@adrienverge
Copy link
Owner

Hello @andrewimeson, thanks for the report. Could this be a duplicate of #334? If yes, could you check whether the problem occurs with version 1.23?

@andrewimeson
Copy link
Contributor Author

@adrienverge You are correct, it is a duplicate of #334. I tried with yamllint 1.23.0, and it works the way I expect it to. I'll close this so we only track it in one place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants