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

Bug: a directory with name *.yml makes yamllint to lint all containing files despite their type #279

Closed
liopic opened this issue Jun 29, 2020 · 2 comments · Fixed by #283

Comments

@liopic
Copy link

liopic commented Jun 29, 2020

Give the following tree structure:
/test.yml
/generated/products.yml/products.sql

When executing yamllint, it scans the file products.sql, which is not yaml, raising an error.

@adrienverge
Copy link
Owner

Thanks for the report. I confirm that with this directory structure:

.
├── dir.yaml
│   └── file.sql
└── file.yaml

running yamllint . tries to lint dir.yaml/file.sql, while it shouldn't.

This is probably linked to

yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

or

yamllint/yamllint/cli.py

Lines 31 to 40 in bbcad94

def find_files_recursively(items, conf):
for item in items:
if os.path.isdir(item):
for root, dirnames, filenames in os.walk(item):
for f in filenames:
filepath = os.path.join(root, f)
if conf.is_yaml_file(filepath):
yield filepath
else:
yield item

Contributions to fix this (and add a test in test_cli.py) are welcome!

@jsok
Copy link
Contributor

jsok commented Jul 10, 2020

Run into this issue today as well:

 yamllint -s -c .yamllint .
./.ivy2/cache/org.yaml/snakeyaml/ivydata-1.17.properties
  1:2       warning  missing starting space in comment  (comments)
  2:2       warning  missing starting space in comment  (comments)
  3:1       warning  missing document start "---"  (document-start)

./.ivy2/cache/org.yaml/snakeyaml/ivy-1.17.xml.original
  1:1       warning  missing document start "---"  (document-start)
  1:121     error    line too long (201 > 120 characters)  (line-length)
  575:121   error    line too long (253 > 120 characters)  (line-length)
  578:121   error    line too long (436 > 120 characters)  (line-length)
  580:121   error    line too long (123 > 120 characters)  (line-length)
  582:121   error    line too long (136 > 120 characters)  (line-length)

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

Successfully merging a pull request may close this issue.

3 participants