Commit Graph

45 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
Sebastian Poxhofer 990c64e0f3 fix(template): do not escape html character with double curly brackets (#42136) 2026-03-25 15:29:25 +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
RahulGautamSingh 9c5deb20d4 test: replace undefined with empty object (#39383)
replace undefined with empty object
2025-11-18 16:48: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
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
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
Juan Carlos Blanco Delgado e4020c118e feat: adding includes helper for templating (#28148) 2024-03-27 19:23:17 +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
Michael Kriese 6af2be726c fix(templates): use re2 for replace helper (#26019) 2023-11-29 01:29:32 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Sebastian Poxhofer 11e30a08f6 refactor: move getChildProcessEnv to break dependency loop (#23144) 2023-07-04 20:34:08 +00:00
Brenton Alker 0913787540 fix(template): Proxy Compile Input loses values from arrays (#21943) 2023-05-03 05:58:33 +00:00
William Boman bf0f7e2b82 feat(template): add equals helper (#21385) 2023-04-09 05:24:04 +00:00
Rhys Arkins 98247d34f3 fix(templates): try/catch handlebars compile (#19794)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-01-14 09:35:33 +01:00
Marek Grzenkowicz 2cd10769f2 feat(template): use environment variables in templates (#19301) 2023-01-03 10:55:41 +00:00
William Boman aecfcdbb3c feat(templates): add decodeURIComponent helper (#19616) 2022-12-31 09:25:06 +00:00
Michael Kriese 2546c03f6c feat(changelogs): defer retrieval if not required for templates (#17073) 2022-08-10 06:19:17 +00:00
Sergei Zharinov 35df2bdb7c fix(template): Use proxy instead of deep clone (#17075) 2022-08-09 17:19:03 +00:00
RahulGautamSingh 3d31fa371d refactor(lib/util): strict null check for test files (#15812)
* add types for tmp

* expand files in lib/util

* update yarn lock

* Update tsconfig.strict.json

* util/exec

* util/git

* util/http

* Revert "util/exec"

This reverts commit 96cf479a1b.

* update strict.json

* redo util/exec

* revert util/git

* util/merge-confidence

* update util/git

* util/package-rules

* fix util/git

* util/template

* util/

* revert extras

* rm newline

* add tmp back

* apply suggestion from review

* util/cache

* more changes

* Update tsconfig.strict.json

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2022-06-19 21:17:46 +00:00
IKEDA Sho 2c087e86f7 feat(template): add lowercase Handlebars helper (#15212) 2022-04-21 09:26:24 +00:00
Michael Kriese 64f5bd5f03 test: enforce lint style rules (#15085) 2022-04-12 14:49:49 +00:00
Marina 7770888184 feat: Add 'and', 'or' and 'containsString' to handlebar helpers (#13341) 2022-01-06 15:24:42 +00:00
markussiebert c80c7f3d0c feat: add stringToPrettyJSON handlebars function (#12643) 2021-11-14 19:49:05 +00:00
Michael Kriese 11aa3baf2e test: use codeql compatible token / passwords (#11297) 2021-09-09 16:17:05 +02:00
Sergei Zharinov 5f4b9f9a3a test: Fix test descriptions and enforce it via new linting rule (#11285) 2021-08-18 05:46:56 +00:00
Rhys Arkins 750bc1656e refactor: config/definitions -> config/options 2021-08-17 07:57:45 +02:00
Sergei Zharinov ce51f05cef feat(test): Detect test utils callers and simplify helpers (#9707) 2021-04-26 16:15:03 +02:00
Sergei Zharinov 72d97ec2f4 refactor(workers): Enforce getName usage (#9525) 2021-04-13 10:25:51 +00:00
Rhys Arkins de8ea37c27 feat: warn about disallowed template variables (#8512) 2021-02-03 09:30:49 +01:00
Rhys Arkins 7c40d2652d feat: template field filtering (#8504) 2021-02-02 18:11:27 +01:00
Rhys Arkins 53ca91301f chore: import linting (#6105) 2020-05-01 18:03:48 +02:00
renovate[bot] 4f59b62da4 chore(deps): update dependency prettier to v2 (#5952)
* chore(deps): update dependency prettier to v2

* Run prettier-fix

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Jamie Magee <jamie.magee@gmail.com>
2020-04-12 18:09:36 +02:00
Rhys Arkins 59d140fc25 feat(internal): template fields enforcement (#5880) 2020-04-06 12:55:34 +02:00