Merge pull request #20157 from Homebrew/shebang-regex

language/*: fix `*_SHEBANG_REGEX` anchors
This commit is contained in:
Carlo Cabrera 2025-06-23 13:02:21 +00:00 committed by GitHub
commit d590e398fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -96,7 +96,7 @@ module Language
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.
NODE_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?node( |$)} NODE_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?node( |$)}
# The length of the longest shebang matching `SHEBANG_REGEX`. # The length of the longest shebang matching `SHEBANG_REGEX`.
NODE_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env node ".length, Integer) NODE_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env node ".length, Integer)

View File

@ -15,7 +15,7 @@ module Language
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.
PERL_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?perl( |$)} PERL_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?perl( |$)}
# The length of the longest shebang matching `SHEBANG_REGEX`. # The length of the longest shebang matching `SHEBANG_REGEX`.
PERL_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env perl ".length, Integer) PERL_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env perl ".length, Integer)

View File

@ -15,7 +15,7 @@ module Language
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.
PHP_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?php( |$)} PHP_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?php( |$)}
# The length of the longest shebang matching `SHEBANG_REGEX`. # The length of the longest shebang matching `SHEBANG_REGEX`.
PHP_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env php ".length, Integer) PHP_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env php ".length, Integer)

View File

@ -112,7 +112,7 @@ module Language
module_function module_function
# A regex to match potential shebang permutations. # A regex to match potential shebang permutations.
PYTHON_SHEBANG_REGEX = %r{^#! ?(?:/usr/bin/(?:env )?)?python(?:[23](?:\.\d{1,2})?)?( |$)} PYTHON_SHEBANG_REGEX = %r{\A#! ?(?:/usr/bin/(?:env )?)?python(?:[23](?:\.\d{1,2})?)?( |$)}
# The length of the longest shebang matching `SHEBANG_REGEX`. # The length of the longest shebang matching `SHEBANG_REGEX`.
PYTHON_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env pythonx.yyy ".length, Integer) PYTHON_SHEBANG_MAX_LENGTH = T.let("#! /usr/bin/env pythonx.yyy ".length, Integer)