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

cli: Cleanly skip broken symlinks that are ignored #654

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

adrienverge
Copy link
Owner

Before this commit, yamllint would output "[Errno 2] No such file or directory" when running on a directory which contained a broken symbolic link, even if the file is set to be ignored in yamllint configuration.

This commit fixes that, and adds corresponding tests.

As a side effect this changes yamllint.linter.run(stream, config), so tools that would use this API need to filter ignored files beforehand.

Fixes #399

Before this commit, yamllint would output "[Errno 2] No such file or
directory" when running on a directory which contained a broken symbolic
link, even if the file is set to be ignored in yamllint configuration.

This commit fixes that, and adds corresponding tests.

As a side effect this changes `yamllint.linter.run(stream, config)`, so
tools that would use this API need to filter ignored files beforehand.

Fixes #399
@coveralls
Copy link

Coverage Status

coverage: 99.824% (+0.001%) from 99.823%
when pulling 8673efd on fix/ignore-broken-symlinks
into f66855b on master.

@adrienverge
Copy link
Owner Author

Hello @andrewimeson, this change is related to #524 (comment) and #524 (comment). After reading the code, I think it's a good change, i.e. yamllint.linter.run(stream, config) should lint the YAML input it is given (independently of the filename), and the filter for ignored files should be done upstream. But if you think differently don't hesitate to say so :)

@adrienverge adrienverge merged commit 2344380 into master Feb 15, 2024
14 checks passed
@adrienverge adrienverge deleted the fix/ignore-broken-symlinks branch February 15, 2024 08:54
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 this pull request may close these issues.

Ignoring file that is a broken symbolic link produces "[Errno 2] No such file or directory"
2 participants