Commit Graph

113 Commits

Author SHA1 Message Date
Sebastian Poxhofer df8c4051ff test(core): replace file snapshots with explicit assertions (#45660)
* test(core): replace file snapshots with explicit assertions

* test(core): replace inline snapshots with explicit assertions

* test(core): assert on relevant sections instead of full bodies

* test(core): drop assertions implied by full equality

* test(core): address review feedback

* test(core): use resolves instead of awaiting inside expect
2026-09-04 10:28:55 +00:00
Jamie Tanna 69a629031b feat(templates): always expose renovateVersion (#44969)
As noted in #44756, this would allow templates across Renovate's
different usages to be able to use the `renovateVersion` string as a
template variable.

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-07-30 16:01:51 +00:00
Sebastian Poxhofer 58771bb183 refactor(linters): enabled oxlints func-style (#44691)
* refactor(oxlint): enable func-style

Enable the built-in func-style rule as ["warn", "declaration"] so that
named functions are written as function declarations instead of arrow or
function expressions assigned to variables, matching the convention in
docs/development/best-practices.md (Functions section). Inline arrow
callbacks are unaffected; prefer-arrow-callback continues to cover the
callback direction.

Severity is "warn" instead of "error" as a fallback: a repo-wide run
found 196 pre-existing violations (70 in spec files, 126 in production
code), exceeding the 80-violation fix threshold for this change, so no
violations were fixed here. Follow-up work can convert the offenders
(largest clusters: lib/modules/versioning/ruby, lib/util/cache/package,
lib/modules/versioning/maven, lib/modules/versioning/gradle) and then
raise the rule to "error". Note oxlint 1.72 also supports an
allowTypeAnnotation option if typed consts should remain arrows.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): enforce func-style at error

* refactor(func-style): convert const-arrow functions to declarations in with-cache spec and ruby versioning

* refactor(func-style): convert const-arrow functions to declarations in maven/gradle modules

* refactor(func-style): convert const-arrow functions to declarations in remaining versioning modules

* refactor(func-style): convert const-arrow functions to declarations in platform modules

Discriminated-union closures (ensureCommentRemoval byTopic/byContent
helpers in github, gitlab, bitbucket, bitbucket-server) needed the
narrowed field passed explicitly as a parameter, since function
declarations are hoisted and lose the outer if-narrowing that inline
arrow-function closures previously relied on.

* refactor(func-style): convert const-arrow functions to declarations across util/manager/datasource modules

One case (logger/renovate-logger.ts logOnceFn) is kept as an arrow
function with a documented oxlint-disable: it is stored on
this.logger.once[level] and relies on lexically-bound this, which a
hoisted function declaration would not preserve.

* refactor(func-style): convert remaining const-arrow test helpers to declarations

get-updated.spec.ts: hoisted expectPipCompilePackageAndLockFile to
module scope (it only closes over the module-level pipCompile mock)
and added a documented oxlint-disable for vitest/expect-expect on its
caller test, since oxlint's expect-expect check does not trace
assertions through an externally-defined helper function.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 11:14:22 +00:00
Sebastian Poxhofer ad0b59f8b7 refactor(oxlint): enable vitest/require-to-throw-message (#44421) 2026-07-07 17:47:04 +00:00
Jamie Tanna 2d0bd99308 feat(self-hosted): make user-agent templatable (#43376)
* feat(self-hosted): make `user-agent` templatable

For Mend-hosted apps, it would be useful to provide a little bit more
information for where a Renovate HTTP request is coming from.

To provide more control over the generated field, we can make it
templatable, with the option to specify the `renovateVersion`.

As this now exposes Handlebars syntax to the user, we should be clear
that this `supportsTemplating`, and document with tests what this
allows.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>

* fixup! feat(self-hosted): make `user-agent` templatable

* fixup! feat(self-hosted): make `user-agent` templatable

As we're now returning the defaults in `GlobalConfig.get` calls.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>

---------

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-05-20 16:27:25 +00:00
RahulGautamSingh 71077bdc92 fix: use handlebars.parse() for template validation (#43316)
* fix: use handlebars.parse() for template validation

* readd todo

* Update lib/util/template/index.ts

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>

---------

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
2026-05-13 14:14:11 +00:00
RahulGautamSingh 68cc0f27b2 docs(config/options): add supportsTemplating field (#41859)
* supportsTemplating field

* fix ci issue

* fix ci issue

* move tip below table

* apply suggestions

* docs: show list of options that support templating

* jsodc explanations for internal fields

* add test to ensure no option that applies template.compile() missed supportsTemplating=true

* apply review suggestions

* fix bad merge

* add filePatterns and commands to the list
2026-05-12 06:45:51 +00:00
Sebastian Poxhofer 990c64e0f3 fix(template): do not escape html character with double curly brackets (#42136) 2026-03-25 15:29:25 +00:00
David Xia b96fbcbb9f docs: Fix typo in newDigestShort description (#41796)
Fix typo in newDigestShort description
2026-03-11 12:15:07 +00:00
Sergei Zharinov c5b0a74f82 refactor: Remove constructor parameter properties (#40712) 2026-01-27 11:16:26 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
RahulGautamSingh 214e1da38d feat(config): allow template fields in allowedVersions (#38922)
* handlebars: regsiter add helper

* allow template fields in allowedVersions

* fix test

* fix doc example

* remove comments

* Apply Suggestions

* use empty object instead of undefined

* template(helpers/add): handle undefined/null

* Apply Suggestions

* Apply suggestion from @RahulGautamSingh

* Apply suggestion from @RahulGautamSingh

* fix conflict

* remove unused function

* fix lint issue

* fix test

* Update docs/usage/configuration-options.md

Co-authored-by: Anne Stellingwerf <1637358+astellingwerf@users.noreply.github.com>

* prettier

* throw error if invalid inputs used

---------

Co-authored-by: Anne Stellingwerf <1637358+astellingwerf@users.noreply.github.com>
2025-12-11 14:52:15 +00:00
Michael Kriese c641239c19 fix: use stricter types for renovate config (#39594)
* fix: use stricter types for renovate config

* fix: revert changes

* Apply suggestions from code review
2025-11-28 13:16:27 +00:00
RahulGautamSingh 9c5deb20d4 test: replace undefined with empty object (#39383)
replace undefined with empty object
2025-11-18 16:48:10 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
Anne Stellingwerf cf7997ad62 chore: validate all handlebars helpers are documented (#38932)
* ci: validate all Handlebars helpers are documented

* ci: validate all Handlebars helpers are documented

* chore: validate all handlebars helpers are documented

* chore: validate all handlebars helpers are documented
2025-11-02 12:15:10 +00:00
RahulGautamSingh 9fe43ea69c feat(replacements): improve Package field for prs (#36815) 2025-07-13 08:25:33 +00:00
Amund Tenstad f55b480ebe feat: add decodeBase64 handlebars helper (#36660)
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2025-06-23 18:29:36 +00:00
Colin O'Dell c5a53695b7 feat(config)!: add minor version to default branchTopic to support separateMultipleMinor (#35606)
Changes the default branchTopic to include the minor version when separateMultipleMinor is enabled, ensuring that separateMultipleMinor works properly when hashedBranchLength is also set.

BREAKING CHANGE: This will be a breaking change for any users that have customized their branchTopic and use separateMultipleMinor=true. In those cases, the minor version version will no longer be included in the branch names until they make a similar modification to their branchTopic. For all other users (who haven't set branchTopic or separateMultipleMinor) the behavior should be unchanged.
2025-06-19 11:01:03 +02:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
Michael Kriese 997c23502e test: migrate to vitest (#34475)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2025-02-26 09:35:54 +00:00
Adam Setch 74c87b41e9 feat: convert sourceDirectory to a template eligible config (#32701)
Signed-off-by: Adam Setch <adam.setch@outlook.com>
2024-11-26 05:43:20 +00:00
Rhys Arkins a021e9fe6d feat: currentVersionAgeInDays, newVersionAgeInDays (#31818) 2024-10-10 13:17:31 +00:00
Daniel Hebestreit ed6bcd7b9d feat(template): allow releaseTimestamp & currentVersionTimestamp (#31286) 2024-09-09 17:49:39 +00:00
Michael Kriese 1f65d31601 feat(templates): allow isMinor (#30966) 2024-08-22 16:02:08 +00:00
Aleksandr Mezin 0b3ba6f0ab refactor(template): remove unused containsTemplates() (#30907) 2024-08-20 07:45:39 +00:00
Aleksandr Mezin b55866031d fix(template): avoid false "Disallowed variable name" (#30892) 2024-08-19 21:52:11 +00:00
Aleksandr Mezin f7530157c5 feat(template): add lookupArray and distinct helpers (#30618)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-19 14:05:35 +00:00
Sebastian Poxhofer 2a74013dfc feat(templates): add split helper function (#30673)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-11 06:51:44 +00:00
Yohei Ueki d77d03b849 feat(template): add toJSON, toArray and toObject helpers (#30633)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-08 12:02:32 +00:00
Aleksandr Mezin 9305923558 fix(template): allow prBodyDefinitions in templates (#29893) 2024-06-28 08:29:02 +00:00
HonkingGoose 2d7bf51eba refactor(lib/util/template): fix typo (#29343) 2024-05-30 19:03:50 +00:00
Ілля Мазуряк c09b9a72fb feat: Add newPatch as a variable (#29341) 2024-05-30 11:48:12 +00:00
Juan Carlos Blanco Delgado e4020c118e feat: adding includes helper for templating (#28148) 2024-03-27 19:23:17 +00:00
Rhys Arkins e500e5048d feat(config): expose topLevelOrg, templateOrg to templates (#27997) 2024-03-18 19:42:30 +00:00
Rhys Arkins 55205fbc71 feat: expose branch depTypes for templating (#27948) 2024-03-15 11:24:05 +00:00
Yun Lai 397dda5bd0 feat: allow packageScope in template compilation and add packageScope in maven datasource (#27925)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-03-15 08:51:23 +00:00
renovate[bot] 4c2ce97bb4 build(deps): update dependency prettier to v3.2.2 (#26755)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-01-21 08:20:41 +00:00
Roman 2438616996 feat(templating): adds encodeBase64 handlebars helper (#26197)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-12-11 14:18:49 +00:00
RahulGautamSingh 970586c086 refactor: use re2 (#26088) 2023-12-02 09:13:35 +00:00
Michael Kriese 6af2be726c fix(templates): use re2 for replace helper (#26019) 2023-11-29 01:29:32 +00:00
Sebastian Poxhofer a9e50fd48d fix(template/category): Replaces not working templating field category with categories (#25735) 2023-11-13 21:07:37 +00:00
renovate[bot] e5cbbaaf09 build(deps): update dependency prettier to v3 (#23627)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sergei Zharinov <zharinov@users.noreply.github.com>
2023-11-07 17:12:01 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Rhys Arkins 6ec9d1d62a fix(templating): allow category field (#25075) 2023-10-06 11:34:21 +02:00
Sebastian Poxhofer 11e30a08f6 refactor: move getChildProcessEnv to break dependency loop (#23144) 2023-07-04 20:34:08 +00:00
Adam Setch 0296810cd6 feat(template): allow isGroup (#22331) 2023-05-21 16:31:21 +00:00
Adam Setch 1c82218197 feat(vulnerabilities): handle medium and unknown severities (#22257)
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2023-05-16 15:38:23 +00:00
Adam Setch a2e036e334 feat(vulnerabilities): set, maintain and expose vulnerabilitySeverity for templated fields (#21939) 2023-05-11 15:00:20 +00:00
Brenton Alker 0913787540 fix(template): Proxy Compile Input loses values from arrays (#21943) 2023-05-03 05:58:33 +00:00