Ignore `.git` folder by default
Due to someone creating a branch matching *.yml there is now a file in our .git folder that looks like a .yml file. There should never be a reason to validate yaml files in the .git folder, so this should be ignored by default.
Hello!
It's an interesting idea, but ignoring .git by default would mean ignoring many others like .subversion, .idea, .project, .gradle, etc.
For your specific problem, I suggest hard-removing this branch:
git branch -d your-branch.yaml
git push origin --delete your-branch.yaml
That is the solution to the specific problem, yes. But I find it odd that all dot-folders are not ignored by default, as this is the convention in most tools/systems..? 🤔
I realise it might be a hard sell to change the behaviour so drastically at this point though... 😅
On the other hand, I wouldn't like to skip .github/workflows/*.yml.
On the other hand, I wouldn't like to skip .github/workflows/*.yml.
The same applies to .buildkite/pipeline.yaml for example. It's significantly easier to not have to worry about manually ensuring these are included. Changing this behaviour would be a significant breaking change.
How about a flag that enables a behaviour where files git is ignoring are ignored by yamllint? This could be implemented by checking the output of git ls-files, for example.
But there's the case where you to want to run the linter on new YAML files – before committing them.
Yes, it probably makes sense to only enable that behaviour by setting a flag.
I think using ignore-from-file .gitignore it's a better solution for the specific case. I normally ignore dot-files here and then add exceptions for those being committed