Skip to content

feat(presets): substitute entire parameter string for {{args}}#36771

Merged
rarkins merged 2 commits intorenovatebot:mainfrom
amezin:preset-args
Jul 2, 2025
Merged

feat(presets): substitute entire parameter string for {{args}}#36771
rarkins merged 2 commits intorenovatebot:mainfrom
amezin:preset-args

Conversation

@amezin
Copy link
Copy Markdown
Contributor

@amezin amezin commented Jul 1, 2025

Changes

Allow passing values containing commas to presets. Substitute {{args}} in the preset with the entire string between parentheses.

Context

I use presets for custom regex managers. I pass managerFilePatterns as a parameter. Glob syntax is much more convenient than regex, but glob syntax often needs commas.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

rarkins
rarkins previously approved these changes Jul 1, 2025
@rarkins rarkins requested review from secustor and zharinov July 1, 2025 12:34
Copy link
Copy Markdown
Collaborator

@astellingwerf astellingwerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like it is the wrong solution for this problem. If the comma confuses the preset string parser, shouldn't we instead add support for escaping commas?

{{args}} may still be valuable for varargs kinda references, but that's an entirely different usecase.

@amezin
Copy link
Copy Markdown
Contributor Author

amezin commented Jul 1, 2025

This seems like it is the wrong solution for this problem. If the comma confuses the preset string parser, shouldn't we instead add support for escaping commas?

I use globs instead of regexes exactly to avoid double-escaping (one \ for escaping in regex, one \ for JSON, and you end up with something that's hard to read - and hard to write correctly for other team members).

Also, strictly speaking, such change won't be backwards-compatible.

{{args}} may still be valuable for varargs kinda references, but that's an entirely different usecase.

There's (currently) no way to generate a json array, not even talking about anything more complex. So varargs are pretty much useless. You can't even use arg* as a variable in handlebars.

@rarkins rarkins requested a review from viceice July 2, 2025 05:29
Comment thread lib/config/presets/types.ts Outdated
@rarkins rarkins added this pull request to the merge queue Jul 2, 2025
Merged via the queue into renovatebot:main with commit e49d205 Jul 2, 2025
40 checks passed
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants