Comments (6)
Could you clarify when you get this error?
The unit tests suite currently passes without any error on my computer and in GitHub Actions.
Is this error caused by PR #33?
from pre-commit-hooks.
It's not change related - the master branch fails the same way.
Could be platform related:
"---------- coverage: platform cygwin, python 3.8.12-final-0 ----------"
from pre-commit-hooks.
OK, so it only happened in your development environment so far.
Could you indicate on what repository did you get this error? Is it a public GitHub One?
Was it during a git commit
?
from pre-commit-hooks.
I got it during a git commit (pre-commit) because 'py.test' is effectively executing the tests. I did not get this prior to the first PR as far as I remember.
This just required a small update in test case considering that NotADirectoryError is a suitable exception when trying to open "a/b".
However, I now just think of the following: I often use just 1 letter for temporary files and I created a file name "a' at the root.
After renaming that file the path 'a/b' no longer results in that error type.
I updated a test case to that it trys to access 'README.md/dummy'.
https://github.com/mdeweerd/pre-commit-hooks/blob/9beba6505bc04f9c8015905276efdbf8a46001bb/tests/remove_crlf_test.py#L23 .
The CI is nto running because the pre-commit-config.yaml has not been updated in that branch. But running 'pytest -sv' locally results in:
tests/remove_crlf_test.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pre_commit_hooks/remove_crlf.py:24: in main
text_files = [f for f in args.filenames if is_textfile(f)]
pre_commit_hooks/remove_crlf.py:24: in <listcomp>
text_files = [f for f in args.filenames if is_textfile(f)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = 'README.md/dummy', blocksize = 512
def is_textfile(filename, blocksize=512):
if any(filename.endswith(ext) for ext in KNOWN_BINARY_FILE_EXTS):
return False
> with open(filename, 'rb') as text_file:
E NotADirectoryError: [Errno 20] Not a directory: 'README.md/dummy'
pre_commit_hooks/utils.py:8: NotADirectoryError
from pre-commit-hooks.
Just though of another type of error: when the file is a directory.
So I added "tests" to the list which provokes a IsADirectoryError (see https://github.com/mdeweerd/pre-commit-hooks/blob/9955842742b90dfb3098b2798cf119f6749f94eb/tests/remove_crlf_test.py#L23 ).
tests/remove_crlf_test.py:26:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pre_commit_hooks/remove_crlf.py:24: in main
text_files = [f for f in args.filenames if is_textfile(f)]
pre_commit_hooks/remove_crlf.py:24: in <listcomp>
text_files = [f for f in args.filenames if is_textfile(f)]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = 'tests', blocksize = 512
def is_textfile(filename, blocksize=512):
if any(filename.endswith(ext) for ext in KNOWN_BINARY_FILE_EXTS):
return False
> with open(filename, 'rb') as text_file:
E IsADirectoryError: [Errno 21] Is a directory: 'tests'
pre_commit_hooks/utils.py:8: IsADirectoryError
from pre-commit-hooks.
I merge from the master branch where you just integrated the changes from #33.
So the CI essentially runs but fails with IsADirectroyError because of 'tests':
https://github.com/mdeweerd/pre-commit-hooks/runs/6366531305?check_suite_focus=true
from pre-commit-hooks.
Related Issues (20)
- Ignore empty line in license HOT 2
- insert_license - Only first year range is replaced in existing license HOT 6
- insert_license - Inserting new license with --use-current-year replaces start years in ranges HOT 3
- Matching multiple license headers? HOT 8
- Rename this repo? HOT 3
- insert-license should not add a LF at the end of the license header file if it does not have one, to prevent an ugly empty separator line HOT 2
- Ignore commit amend message files in .git when running forbid-tabs & co by default HOT 7
- CSS (single line comments) set `//` HOT 1
- insert-license detection does not ignore spaces after comment symbols HOT 4
- chmod hook conflicts with shell chmod in a python virtual env HOT 2
- Is there a way of defining a string in the hooks args instead of --license-filepath HOT 1
- How do I specify the hook to be applied to all files in the repo that ends with .py? HOT 2
- breaking changes in 1.5.2 and 1.5.3 - InvalidManifestError HOT 3
- make `forbid-tabs` and `replace-tabs` accept an exclusion list HOT 4
- Feature Request (insert_license): Use multiline comment for python files HOT 1
- Feature Request (insert_license): Dynamic years in license HOT 2
- An error has occurred: InvalidManifestError HOT 3
- pre-commit fails to install/run due to failures within python-Levenshtein-wheels HOT 1
- Error when using `exclude_types`, but not `exclude` HOT 2
- [Enhancement] Update multiple licence year ends in one run. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pre-commit-hooks.