Skip to content

Shellcheck does not allow for shebangs with a space #47

Open

Description

@thibmaek

The custom regex check will fail if the shebang is in the format of #! /usr/bin/bash and only work when removing the space e.g #!/usr/bin/bash.

Spaces in shebangs are valid.

Activity

  1. brikis98 commented on Dec 17, 2020

    @brikis98
    Member

    Do we have a script with a space after the shebang somewhere?

  2. thibmaek commented on Dec 17, 2020

    @thibmaek
    Author

    Not in this repo maybe, but if I try to use this hook in a repo it will not work unless removing the space.
    I tried to test by changing the regex and validating on regexr but I'm not sure which format of regex that is (PCRE?)

  3. brikis98 commented on Dec 18, 2020

    @brikis98
    Member

    Ohhh, I think I misunderstood. What you're saying is that the regex we use to identify shell scripts is what would need to be fixed?

  4. thibmaek commented on Dec 21, 2020

    @thibmaek
    Author

    Yep indeed, the regex needs to option to allow a space between right after the bang symbol:

    • regex validates: #!/usr/bin/env bash
    • regex invalidates: #! /usr/bin/env bash
  5. brikis98 commented on Jan 6, 2021

    @brikis98
    Member

    Understood! And, indeed, spaces after shebang are allowed, as you mentioned. Would you be up for a PR to tweak the regex?

  6. thibmaek commented on Jan 6, 2021

    @thibmaek
    Author

    Yeah sure, do you know what format the regex is? I tried it on regexr but it didn't validate. Maybe its perl regex?

  7. brikis98 commented on Jan 7, 2021

    @brikis98
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions