alexcouper / captainhook

Git hook scripts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`file` will incorrectly determine things to be Python

OddBloke opened this issue · comments

NO CAPTAINHOOK MY BEHAVE SCENARIOS DONT COMPILE IN PYTHON 3 IM SORRY OK

We should probably shift to only using file if there is no extension.

I believe both of you are running Ubuntu, right?

Yep. Ubuntu 14.04 here.

λ bubblegum captainhook → λ git master → file README.md 
README.md: Python script, ASCII text executable

We may need to go down a different route with this and say a python file is one that ends in .py or has python in the first line of the file?

If it makes you feel any better, @koddsson, file on my Mac tells me that all my .py files are Java.

Hahah just a tad. Is there a reason why we are using the file utility rather than just going by extension?

Maybe we can do something like:

  • Check the extension.
  • Check if the first line includes python.
  • Fallback to the file command.

@koddsson The reason for this check is that the captainhook script itself had pep8 errors which was kind of ironic.

Yes, the flow you describe makes sense

Fixed.