pre-commit / pre-commit-hooks

Some out-of-the-box hooks for pre-commit
MIT License
5.33k stars 705 forks source link

End-of-file-fixer breaks markdown-files for sphinx #921

Closed aecorn closed 1 year ago

aecorn commented 1 year ago

I have two files with very simple content in /docs

index.md ../README.md

contributing.md ../CONTRIBUTING.md

When running the pre-commit it runs "end-of-file-fixer". This "fixes" these two files. image

When the github-action later tries to run for building with sphinx, it fails because index.md is not a valid file anymore.

image image

Currently just excluding the folder in .pre-commit-config.yaml: image

asottile commented 1 year ago

are you sure those aren't symlinks and you're on windows but did not enable symlinks support?

aecorn commented 1 year ago

I made the .md files myself as .md files in VSCode, so if they are symlinks, there must be some Magic that Im not aware of. Is it their content which are making them into symlinks? The pre-commit hooks seem to operate on them as files, both prettier and end-of-file-fixer.

asottile commented 1 year ago

I don't think this has anything to do with pre-commit-hooks then -- if they're symlinks yeah I could see that messing them up on windows but a file that just has a path in it doesn't seem like useful markdown

asottile commented 1 year ago

yeah they're symlinks as I suspected -- you should enable symlink support on windows https://github.com/statisticsnorway/ssb-project-cli/tree/main/docs