18 Commits

Author SHA1 Message Date
Carlo Cabrera
6a7416c296
language/*: fix *_SHEBANG_REGEX anchors
We should use `\A` to pick up shebangs at the start of files instead of
just anywhere in a given script.

See Homebrew/homebrew-core#227654 for an example where this can cause
problems.
2025-06-23 20:32:55 +08:00
botantony
dac4b6fd56
shebangs: fix broken shebangs like #!python
Signed-off-by: botantony <antonsm21@gmail.com>
2025-03-21 00:34:14 +01:00
Bo Anderson
6db4ed2793
Replace some include Kernel usages with requires_ancestor 2024-08-20 19:10:14 +01:00
Mike McQuaid
debdc30aa0
language/*: only check required deps in detected_*_shebang
Otherwise, we rewrite this even when we have a e.g. build or test
dependency on NodeJS.

See context in:
https://github.com/Homebrew/homebrew-core/issues/176257#issuecomment-2277602215
2024-08-09 14:08:29 +01:00
Michael Cho
61f8ebc462
language/perl: enable typed: strict
Signed-off-by: Michael Cho <michael@michaelcho.dev>
2024-03-29 20:14:01 -04:00
Issy Long
f682147598
Fix RuboCop Style/RedundantFreeze offenses 2024-01-18 22:20:01 +00:00
Sam Ford
370e61e504
perl: refactor to align Shebang modules
This primarily reworks `Language::Perl::Shebang` to use constants for
the shebang regex and max length (like the previous Node commit) and
to extract the `RewriteInfo` call into a separate method (like Python
and Node).

Besides that, this also adds type signatures to the methods.
2023-08-15 00:53:41 -04:00
Bo Anderson
d1b923f314
Introduce UsesFromMacOSDependency
Add Formula#declared_deps and SoftwareSpec#declared_deps
2023-07-04 13:40:55 +01:00
Douglas Eichelberger
d7d8f2cacb Revert language mixins back to module_function 2023-04-18 06:17:22 -07:00
Douglas Eichelberger
09c679e75f Refactor module_function to reduce rbi need 2023-04-17 10:37:59 -07:00
Mike McQuaid
b622c36be6
Add, use uses_from_macos_names.
This strips e.g. `:build` tags.
2021-09-14 09:48:19 +01:00
Bo Anderson
8dd11e4e4c
Set uses_from_macos_elements in all cases 2021-09-14 04:06:40 +01:00
Bo Anderson
5f41016267
Support handling of rewriting shebangs with flags
Fixes #11108.
2021-05-10 06:13:58 +01:00
Bo Anderson
8db3c6bfd0
language/perl: use versioned shebang 2021-05-10 05:50:08 +01:00
Bo Anderson
728bb547a7
language: raise ShebangDetectionError rather than a generic error 2021-05-10 05:50:08 +01:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Markus Reiter
4972b1935e Document Language::Perl. 2020-08-26 03:13:58 +02:00
Bo Anderson
878bb0e983 language/perl: add detected_perl_shebang 2020-03-27 19:18:19 +00:00