yamllint icon indicating copy to clipboard operation
yamllint copied to clipboard

Ignore `.git` folder by default

Open choffa opened this issue 3 years ago • 7 comments

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.

choffa avatar Nov 29 '22 12:11 choffa

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

adrienverge avatar Dec 12 '22 18:12 adrienverge

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... 😅

choffa avatar Dec 15 '22 12:12 choffa

On the other hand, I wouldn't like to skip .github/workflows/*.yml.

DimitriPapadopoulos avatar Jan 02 '23 17:01 DimitriPapadopoulos

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.

mwgamble avatar Jan 03 '23 06:01 mwgamble

But there's the case where you to want to run the linter on new YAML files – before committing them.

DimitriPapadopoulos avatar Jan 03 '23 06:01 DimitriPapadopoulos

Yes, it probably makes sense to only enable that behaviour by setting a flag.

mwgamble avatar Jan 03 '23 07:01 mwgamble

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

drAlberT avatar Aug 04 '23 14:08 drAlberT