econchick / interrogate

Explain yourself! Interrogate a codebase for docstring coverage.
https://interrogate.readthedocs.io
MIT License
565 stars 46 forks source link

Refuses to scan executable python scripts that don't end in .py #104

Open dragonpaw opened 2 years ago

dragonpaw commented 2 years ago

Description of the bug

In the code there's an automatic error if if not path.endswith(".py") but python executables usually lack the file extension.

What you expected to happen

Scan the python file.

How to reproduce (as minimally and precisely as possible)

Make a python file with a #! line, but no .py in the filename.

Anthing else we need to know?

As an example, we're trying to use interrogate with a project that has a couple of python scripts within the repo in a bin directory, and none of them end in .py.

❯ interrogate bin/postgres-ready
E: Invalid file '[...]/bin/postgres-ready'. Unable interrogate non-Python files.

❯ identify-cli bin/postgres-ready  # from pre-commit
["executable", "file", "python", "text"]

❯ file bin/postgres-ready
bin/postgres-ready: Python script text executable, ASCII text

❯ head -1 bin/postgres-ready
#!/usr/bin/env python