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
Cannot run --files on Windows #1476
Comments
please share your configuration -- I suspect you've got an |
Hey @asottile , Here are the configuration files. The file we were trying to format was However, I thought that we had ruled out this being a configuration issue, for two reasons:
Thank you for any help!
|
can you show the exact command you ran? |
On Windows:
On Mac: $ pre-commit run --files trase/supplychain/test/test_supplychain.py
black....................................................................Passed
isort....................................................................Passed I'm wondering if it is something odd about passing the file path on Windows. I've noticed that I get "skipped" on a Mac with |
ok, I can now reproduce this, it seems that when I switched everything to use forward slashes for the regexes, I forgot to handle global thanks for the report! (I'm working on this on stream right now https://twitch.tv/anthonywritescode) |
Amazing - I love the twitch livestream. Thank you for the fix! By the way, Python's stdlib has a great module for converting the a file path to posix-style, maybe it will catch some odd edge cases that aren't covered in your https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.as_posix |
yeah it's literally the same thing: def as_posix(self):
"""Return the string representation of the path with forward (/)
slashes."""
f = self._flavour
return str(self).replace(f.sep, '/') |
(pre-commit version 2.4.0) We're running in to an odd issue on Windows
However, running
pre-commit run --all-files
will correctly format the file. Equally, runningpre-commit run --files my_file.py
in the same repository on a Mac works fine.It's like the file is somehow not being read in Windows... Has anybody else encountered this?
The text was updated successfully, but these errors were encountered: