Closed OddBloke closed 10 years ago
Yep, this would be great!
The best way to do it would probably be to use python-magic (https://github.com/ahupp/python-magic) to look at all of the files being staged. However, this would introduce an external dependency in to the hook file, which we currently can't handle.
So we could either use the file
command directly using bash()
, or we could try and think of a way of having access to Python dependencies from within the installed stuff (which would also be useful for flake8).
I prefer not to have dependencies if possible. Obviously flake8 is one already, but what we're talking about here would be used by python3 and pdb checkers too, so I'd lean towards the file approach I guess...
This is also going to be a problem with the isort
checker, once I write it.
I'll have a play around at some point to see if I can find a decent way of having access to dependencies.
In the mean time, though, fixing this by calling file directly is (I agree) probably the thing to do.
I believe this is resolved as of #27
We have a couple of flake8 errors in the
captainhook
script which we haven't noticed because we only look at files matching "*.py".file
works out that it's Python, so there should be something relatively easy we can do: