Commit Graph

64 Commits

Author SHA1 Message Date
Sergei Zharinov ac2fc77641 refactor(http-mock): Remove request tracing (#44482)
* refactor(http-mock): remove request tracing

* test: replace remaining HTTP trace assertions
2026-09-23 09:01:01 +00:00
Nikos Angelopoulos d4c29b1cfd fix(github-graphql): lower shrinkPageSize floor from 25 to 5 (#45460) 2026-08-25 23:02:27 +00:00
Sebastian Poxhofer a1971afa78 fix(linters): add linting rule to enforce usage of our regEx utility (#44690)
* ci(linter): add renovate/require-regex-util rule

Adds a custom oxlint rule that flags raw RegExp usage in lib/
production code: any `new RegExp(...)` call and any regex literal
that is not the direct first argument of `regEx(...)`. The regEx()
helper from lib/util/regex.ts uses the RE2 engine for ReDoS-safe
matching and caches compiled patterns. lib/util/regex.ts itself is
exempt.

The rule is disabled for **/*.spec.ts, test/**, and tools/** via
config overrides, because vitest APIs such as expect.stringMatching
need bare RegExp instances (a past commit reverted regEx() there).

Severity is set to "warn" instead of "error": the repo currently has
197 pre-existing violations (above the agreed mechanical-fix
threshold of 80), and a number of them are deliberately
RE2-incompatible patterns (lookahead/lookbehind/named backreferences,
see TODO #12872/#12875 markers in e.g. lib/modules/versioning/rez/
pattern.ts and lib/modules/manager/dockerfile/extract.ts) that need
per-site judgment before they can be wrapped in regEx() or suppressed
with a justified disable comment. No violation fixes are included in
this commit.

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

* ci(linter): enforce renovate/require-regex-util at error

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

* refactor: use regEx() for regex literals and RegExp construction in lib

Burn down all renovate/require-regex-util violations (197):

- wrap RE2-compatible regex literals and RegExp constructions in regEx()
- rewrite lookaround patterns where behavior is provably preserved:
  goproxy separator split, sbt-package link extraction, leiningen
  comment stripping and keyword search, npm GitHub owner validation
  (unit-count bound replaced by an explicit length check)
- keep native RegExp with disable comments where RE2 cannot be used:
  moo / good-enough-parser lexer patterns (moo rejects RE2 instances),
  MigrationsService propertyName (matched via isRegExp, which RE2
  instances fail), rez named backreferences and lookaheads, GitHub
  markdown link negative lookbehind, emoji astral-plane matching
- drop stale TODO #12875 comments for patterns current re2 handles

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

* refactor: reduce require-regex-util disable comments

Rewrite the github massage-markdown-links URL regex to capture an
optional `api.` prefix in a named group (skipped in code) instead of
relying on a negative lookbehind, so both the base and global variants
can use regEx()/RE2 and their two disable comments are removed. Add
spec cases for api-prefixed URLs that match the URL shape.

Consolidate the four related line disables in rez/pattern.ts (bound and
range patterns emulating Python conditional patterns via named
backreferences and lookaheads, which RE2 cannot express) into a single
block disable/enable pair, matching the treatment of the lexer files.

Disable comment count drops from 13 to 8.

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

* refactor(datasource/sbt-package): use named capture group in link regex

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

* refactor(manager/cake): restore original multiLineComment regex spelling

The [^] -> [\\s\\S] rewrite was only needed for an RE2 wrap that was
later reverted; keep the diff minimal.

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

* fix(datasource/go): skip empty GOPROXY segments

The switch from a lookahead split to a capture-group split (needed because
RE2 has no lookahead support) changed how empty GOPROXY segments parse:
`a|,b` yielded `{ url: ',', fallback: '|' }` before and
`{ url: '', fallback: ',' }` after. The comma fallback only continues on
404/410, so a failing proxy ahead of an empty segment silently stopped the
lookup instead of falling through to the remaining proxies.

Empty segments carry no url to query, so drop them.

* refactor(datasource/go): use isTruthy for empty segment filter

* fix(datasource/go): filter empty segments before mapping

Filtering after the map broke the contextual typing from the
GoproxyItem[] annotation, widening fallback to string.

* refactor(platform/github): use regEx() for merge queue query stripping

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 14:30:46 +00:00
Sebastian Poxhofer e01b50c6ab refactor(linter): oxlint prefer partial typed casts for consts (#45239)
* refactor: flag all typed object literal casts in prefer-partial-in-specs

* refactor: type maven spec httpError helper against got response shape
2026-08-12 08:50:57 +00:00
Jamie Tanna 8108714fc3 docs: validate JSONC and Javascript code blocks (#45063)
* docs: correct `onboardingConfig` example

As we'll be enforcing this as valid Global config in future commits.

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

* docs: correct `module.exports` syntax

As we'll be enforcing this as valid Global config in future commits.

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

* docs: completely skip `doc-fence-check` on code blocks only used for synatx highlighting

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

* docs: skip schema validation on non-config snippets

As we'll be enforcing this as valid Global config in future commits.

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

* chore(tools/doc-fence-check): validate JSONC and Javascript code blocks

To further ensure that our documentation is well-formed, we can validate
that JSONC and Javascript code blocks are well-formed syntactically, and
are valid Renovate configuration.

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

* chore(tools/doc-fence-check): allow opting out of syntax validation

On top of schema validation wanting to be disabled, we should also
support disabling the syntax validation, in the case that we're using
`json` code blocks for syntax highlighting, but they're not necessarily
well-formed JSON.

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

* docs: use `json` syntax highlighting

As `jsonc` doesn't seem to exist in Material for MkDocs.

As it's only for syntax highlighting, we need to opt out of validation.

* tsc

---------

Co-authored-by: Claude Sonnet 5 <jamie.tanna+claude-code@mend.io>
2026-08-04 13:18:08 +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 64e6a4c71f refactor(oxlint): enable unicorn/prefer-at (#44556)
Enable the unicorn/prefer-at rule as error in .oxlintrc.json and fix all
43 pre-existing violations (arr[arr.length - 1] -> arr.at(-1)) via oxlint
autofix. Where .at() widened the type to T | undefined, non-null
assertions were added at sites where surrounding logic guarantees the
element exists (length guards, split results), preserving the original
runtime behavior and typing.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 12:57:23 +00:00
Sebastian Poxhofer 9717259ffc refactor(oxlint): enable no-else-return and unicorn/no-lonely-if (#44553)
Enable no-else-return (with allowElseIf: false) and unicorn/no-lonely-if
as errors in .oxlintrc.json and fix all 131 pre-existing violations
(91 no-else-return, 40 unicorn/no-lonely-if) across 98 files.

The no-else-return violations were fixed with the oxlint autofix
(iterated to a fixpoint, plus two else-if chains that required
--fix-dangerously) followed by Prettier formatting. One comment dropped
by the autofix in lib/modules/manager/pub/artifacts.ts was restored
manually. The unicorn/no-lonely-if violations were merged by hand,
preserving comments and coverage-ignore hints.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-14 12:11:21 +00:00
Sebastian Poxhofer ad0b59f8b7 refactor(oxlint): enable vitest/require-to-throw-message (#44421) 2026-07-07 17:47:04 +00:00
Sebastian Poxhofer b106668a95 refactor(oxlint): enable typescript/no-useless-default-assignment (#44419)
- Convert `param: T | undefined = undefined` to optional `param?: T`.
- Drop dead `= false` defaults on the required cache-provider options.
- Make `GraphqlPaginatedContent.nodes/edges` optional so the `= []`
  fallbacks (load-bearing for partial GraphQL connections) are valid.
- Type the unchecked `default_branch` response field as optional so
  the `'HEAD'` fallback is retained.
- Drop `tag = undefined` from the Forgejo/Gitea/GitLab preset configs.

Part of #43845

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-07 16:38:48 +00:00
Sebastian Poxhofer 15f4bd8eff chore: migrate from zod/v3 to zod/v4 (#43691)
* chore: migrate from zod/v3 to zod/v4

This commit contains the logic changes

* chore: migrate imports from zod/v3 to zod/v4

This contains import updates and adds explicit record keys as zod/v4 requires these now

* ci: enforce usage of zod/v4
2026-05-30 16:01:58 +00:00
Sebastian Poxhofer 0793274b86 refactor: prefer templates rather than + in test files (#43441)
refactor: prefer templates rather than `+`
2026-05-19 09:52:28 +00:00
Jamie Tanna ff6761ed23 fix(config/global): return default values for GlobalConfig.get (#42113)
* fix(config/global): return default values for `GlobalConfig.get`

As noted in #39949, it can be awkward working with in `GlobalConfig.get`, where
we would previously need to specify the default value when calling `.get`,
which could lead to drift with the defaults for a given config option.

To reduce this risk, we can rely on a given `default` for a configuration
option, providing that as a default.

Because this now definitely returns a value that matches the config option, it
now allows us to remove `!` assertions.

* fixup! fix(config/global): return default values for `GlobalConfig.get`

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>

* fixup! fix(config/global): return default values for `GlobalConfig.get`

* test(presets): remove impossible test

As it's now not possible to set a value as `undefined` (as
`GlobalConfig` will then use the default), this test no longer validates
anything.

* test(workers/repository): add mock

Now `platform` defaults to `github`, we need to mock out the call to
fetch config.

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

* test: coverage

* test: coverage

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@mend.io>
2026-05-15 17:10:38 +00:00
renovate[bot] 645a28c77c build(deps): update dependency prettier to v3.8.1 (main) (#39779)
* build(deps): update dependency prettier to v3.8.1

| datasource | package  | from  | to    |
| ---------- | -------- | ----- | ----- |
| npm        | prettier | 3.6.2 | 3.8.1 |

* fixup prettier

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
2026-02-18 08:41:34 +00:00
renovate[bot] 4a2578d18d build(deps): update dependency zod to v4 (main) (#41225)
* build(deps): update dependency zod to v4

| datasource | package | from    | to    |
| ---------- | ------- | ------- | ----- |
| npm        | zod     | 3.25.76 | 4.3.6 |

* fix: zod migration

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-18 07:37:50 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +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
Michael Kriese 9fe353adb4 test: add coverage (part1) (#40636) 2026-01-23 15:09:01 +00:00
renovate[bot] acacad57c6 chore(deps): update linters (main) (#40277)
* chore(deps): update linters

| datasource | package              | from   | to     |
| ---------- | -------------------- | ------ | ------ |
| npm        | eslint-plugin-oxlint | 1.36.0 | 1.38.0 |
| npm        | typescript-eslint    | 8.50.1 | 8.52.0 |

* chore: enable oxlint gha format

* chore: fix lint

* chore: fix lint

* chore: fix lint

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-01-14 15:32:48 +00:00
Sergei Zharinov 65a961cceb refactor(github): add GraphQL branch query adapter (#40177)
* refactor(github): add GraphQL branch query adapter

Add infrastructure for querying GitHub branches via GraphQL:
- Add branches-query-adapter following the tags-query-adapter pattern
- Add GithubBranchItem type
- Export queryBranches function
- Register cache namespace

* style: fix prettier formatting

* test: add queryBranches coverage

* Refactor undefined checks to use `is.undefined`

Replace direct comparison of `undefined` with the `is.undefined` helper for consistency.

* refactor: use maxItems instead of maxPages
2025-12-28 17:16:19 +00:00
renovate[bot] b34bbb5b2a chore(deps): update linters (main) (#38897)
* chore(deps): update linters

| datasource | package           | from   | to     |
| ---------- | ----------------- | ------ | ------ |
| npm        | @eslint/js        | 9.37.0 | 9.39.0 |
| npm        | eslint            | 9.37.0 | 9.39.0 |
| npm        | typescript-eslint | 8.45.0 | 8.46.2 |

* refactor: fix lint issues (#39183)

* chore(deps): update linters

| datasource | package           | from   | to     |
| ---------- | ----------------- | ------ | ------ |
| npm        | @eslint/js        | 9.37.0 | 9.38.0 |
| npm        | eslint            | 9.37.0 | 9.38.0 |
| npm        | typescript-eslint | 8.45.0 | 8.46.2 |

* chore(deps): update linters

| datasource | package           | from   | to     |
| ---------- | ----------------- | ------ | ------ |
| npm        | @eslint/js        | 9.37.0 | 9.39.0 |
| npm        | eslint            | 9.37.0 | 9.39.0 |
| npm        | typescript-eslint | 8.45.0 | 8.46.2 |

* refactor

* revert unwanted changes

* version sync

* version sync

* sync versions

* sync versions

* Apply suggestion from @RahulGautamSingh

* use named exports

* fix new lint issues

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
2025-11-10 10:33:01 +00:00
renovate[bot] aeb0cb5e2b build(deps): update dependency p-all to v5 (main) (#36425)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-06-10 13:47:32 +00:00
renovate[bot] d58869b83d build(deps): update dependency p-map to v7 (main) (#36426)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-06-10 12:58:30 +00:00
Sergei Zharinov 7e5300f3ed fix(github-tags): Add support for even more nested GraphQL responses (#36166)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-05-27 19:43:32 +00:00
renovate[bot] fffd986fa7 chore(deps): update linters (main) (#35113)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-04-02 14:28:27 +00:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
Trim21 6e5731b554 test: migrate from jest to vitest (#34499) 2025-02-26 14:18:38 +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
Sergei Zharinov a33d3eab9e feat: Switch to Timestamp type (#33648) 2025-01-22 20:15:25 +00:00
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
Sergei Zharinov 650ac22a3a feat: Support cachePrivatePackages for GitHub GraphQL tags and releases (#30123) 2024-07-10 21:29:01 +00:00
Sergei Zharinov 5c0628bf3b feat(host-rules): Support readOnly request matching (#28562)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-04-23 03:26:20 +00:00
Sergei Zharinov 3ffebd64ce feat(github): Add 30 minutes debounce between cache syncs (#27058)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-02-18 15:51:26 +00:00
Sergei Zharinov f587531130 refactor(cache): Restrict type for package cache namespaces (#27121) 2024-02-08 07:35:41 +00:00
renovate[bot] 11e35e4292 chore(deps): update dependency @types/luxon to v3.3.7 (#26193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-01-04 07:39:47 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Sergei Zharinov f19eff92ce fix(github): Reconcile entire GraphQL pages (#25311) 2023-10-20 05:47:21 +00:00
Sergei Zharinov 8a25d33478 fix(github): Fix update detection for GraphQL incremental cache (#24503) 2023-09-19 04:40:05 +00:00
Michael Kriese 84a97a62fa test(perf): improve test speed (#24323) 2023-09-08 11:40:04 +00:00
HonkingGoose 76c9c63417 docs: use simple words (#23989) 2023-08-22 14:07:21 +02:00
Sergei Zharinov 53263bbfda feat: Clone objects via wrapper (#22970) 2023-06-27 13:09:59 +00:00
RahulGautamSingh be2a89520b refactor: replace as assertions (#22442) 2023-06-05 19:18:30 +00:00
RahulGautamSingh 938a36801e refactor: replace test.each with it.each (#21859) 2023-04-28 04:33:15 +00:00
Jamie Magee a6dfa70c1d chore: migrate to structuredClone (#20885)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-04-27 05:06:22 +00:00
Chuck Grindel a12ac33f0f fix(cache): use UTC dates for cache strategy calculations (#21488) 2023-04-13 15:01:04 +00:00
renovate[bot] da29ed179c chore(deps): update dependency @types/luxon to v3.3.0 (#21418)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
2023-04-12 06:49:00 +00:00
Chuck Grindel 2667ea16d1 fix: update cache record TTL to not account for Daylight Saving time (#21389) 2023-04-08 04:24:39 +00:00
RahulGautamSingh 1013302e0f refactor: exactOptionalPropertyTypes (#20761)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-03-19 16:09:46 +00:00
Sergei Zharinov 42b0e102e4 feat(github): Don't store updatedAt field in GraphQL cache record (#21024) 2023-03-18 14:52:01 +00:00