-
-
Notifications
You must be signed in to change notification settings - Fork 719
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
Add check for illegal Widnows names #1031
Add check for illegal Widnows names #1031
Conversation
17efd6f
to
994a148
Compare
Took advice from #590 and created a new PR ... sorry for delay |
name: check illegal windows names | ||
entry: Illegal windows filenames detected | ||
language: fail | ||
files: '(?i)(^|/)(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|/|$)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add a quick little test which loads this regex from the configuration and runs it against a few expected values?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asottile @ericfrederich I recommend checking for the :
character as well (see my comment in #589 regarding :Zone.Identifier files).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jleclanche looks like this got merged without code checking for the :
but no release has been made yet.
I just checked and it's definitely a problem on Windows. I created a file foo:bar
on linux, commited, pushed, then pulled down the repo from Windows and got greeted with error: invalid path 'foo:bar'
I'll add a test for it and a new PR
644db3e
to
f2915d1
Compare
Tests added, let me know if that's what you had in mind. |
f2915d1
to
8654097
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments in pre-commit#1031
Any plans on releasing a new version soon with this check included? Just read about it on the Webpage, tried to add it, but it wasn't found. Then checked the dates, and the last release of pre-commit was before this PR was merged... |
you're confused? |
Am I? Is there a plan to create a new release that includes the check-illegal-windows-names hook? EDIT: And I came across it while reading through https://github.com/pre-commit/pre-commit-hooks where said hook is already listed. |
have you read the pre-commit docs? |
Probably not the part you have in mind. You are welcome to point me to what you want me to read. |
Fixes #589