Skip to content

Add a fast path for the check-shebang-scripts-are-executable hook #1834

@Jackenmen

Description

@Jackenmen

This makes sure that a file that starts with #! has the executable bit set. What's important to note here is that this has to work correctly on filesystems that don't have an executable bit, too. This means that you need to check the executable bit in the Git index on e.g. Windows.

FYI, prek does support a similarly named check-executables-have-shebangs hook (https://prek.j178.dev/builtin/#check-executables-have-shebangs) - that hook basically does the opposite of what the check-shebang-scripts-are-executable hook proposed here does - it checks that a non-binary file with an executable bit actually starts with #!.

Link to description:
https://github.com/pre-commit/pre-commit-hooks#check-shebang-scripts-are-executable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions