Commit Graph

34 Commits

Author SHA1 Message Date
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 16ef1715e9 refactor(linters): add rules for @sindresorhus/is helpers (#45229)
* feat(lint): add renovate/prefer-is-helpers and renovate/prefer-is-object rules

Flag ad-hoc type checks that have @sindresorhus/is equivalents:
- .filter(Boolean) -> .filter(isTruthy)
- typeof x === 'string' -> isString(x)
- x === null || x === undefined -> isNullOrUndefined(x) (and negation)

The typeof x === 'object' shape lives in a separate suggestion-only rule
(renovate/prefer-is-object, kept at warn) because isObject()/isPlainObject()
are not drop-in equivalents: null, arrays and functions behave differently.

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

* refactor: fix renovate/prefer-is-helpers violations

Replace ad-hoc type checks with @sindresorhus/is helpers across lib/:
- 13x .filter(Boolean) -> .filter(isTruthy)
- 36x typeof x ==/!== 'string' -> isString(x) / !isString(x)
- 6x x === null || x === undefined -> isNullOrUndefined(x) (and negation)

Promote renovate/prefer-is-helpers to error now that the codebase is clean.
renovate/prefer-is-object stays at warn: its 15 remaining sites guard
parsed YAML/JSON or unknown values where isObject()/isPlainObject() are
not provably equivalent (null/array/function semantics).

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

* refactor: enforce renovate/prefer-is-object at error level

Resolve the 15 remaining warnings and raise the rule from warn to error:

- Migrate 10 sites to isObject() where the guarded value provably cannot
  be a function (parsed YAML/JSON, typed exec command arguments, or
  test-controlled fixtures): helm-values, woodpecker, bun, pre-commit
  managers, exec utils, file package cache, and the github http spec.
  In the bun manager this also fixes a latent crash where a null
  `workspaces` value would throw on the `in` operator.
- Keep 5 sites as reasoned oxlint-disable comments where excluding
  functions is load-bearing: the byte-exact fingerprint canonicalizer
  (2), the circularity walker, the zod result guard, and the generic
  hasKey helper.

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

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-13 14:22:03 +00:00
renovate[bot] 196101a6bb chore(deps): update dependency oxlint-tsgolint to v0.25.0 (main) (#44424)
* chore(deps): update dependency oxlint-tsgolint to v0.25.0

| datasource | package         | from   | to     |
| ---------- | --------------- | ------ | ------ |
| npm        | oxlint-tsgolint | 0.23.0 | 0.25.0 |

* chore: fix new no-unnecessary-type-assertion findings

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

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Sebastian Poxhofer <sebastian.poxhofer@stedi.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-28 07:04:21 +00:00
Pieter Willekens f88e12040b feat(datasource/packagist): prefer published-time over time for release timestamp (#44021)
* feat(datasource/packagist): prefer published-time over time for release timestamp

* refactor(datasource/packagist): use Nullish util for published-time

* Update lib/modules/datasource/packagist/schema.ts

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

---------

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
2026-06-18 09:47:53 +00:00
Pieter Willekens 3575630864 feat(datasource/packagist): mark abandoned packages as deprecated (#44037)
* feat(datasource/packagist): mark abandoned packages as deprecated

Parse Packagist's `abandoned` field and surface it via `isDeprecated`
and `deprecationMessage`, matching how the npm datasource handles npm's
`deprecated` field. When `abandoned` is a replacement package name, the
message suggests it.

This is an official registry signal, so it maps to Renovate's
deprecation mechanism, not the timestamp-based abandonment heuristic.

* test(datasource/packagist): drop incorrect output-type annotation on raw input

* update tests

* Update lib/modules/datasource/packagist/schema.ts

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

---------

Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
2026-06-18 08:36:07 +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
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 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 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
Sergei Zharinov 057e602075 fix(composer): Allow for numbers as composer release version (#36486) 2025-06-13 04:24:20 +00:00
Sergei Zharinov a33d3eab9e feat: Switch to Timestamp type (#33648) 2025-01-22 20:15:25 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Sergei Zharinov 1f3a14addb fix(datasource/packagist): Use serializable type for availablePackages (#23117) 2023-07-03 17:54:20 +00:00
Sergei Zharinov c3029596b7 feat(packagist): Query packages respecting available-packages (#22877) 2023-06-20 07:08:38 +00:00
Sergei Zharinov 3fbdcdc1ae refactor(schema): Enhanced "loose" collections (#21541) 2023-04-21 08:25:48 +00:00
Sergei Zharinov 8081d08ec4 refactor(http): Enhanced integration with data schemas (#21338) 2023-04-06 15:56:27 +00:00
Sergei Zharinov e66b93a240 refactor(schema): Remove looseObject helper (#21164) 2023-03-27 10:43:02 +00:00
Sergei Zharinov d37a372356 fix(packagist): Support both objects and minified arrays in v2 (#20720) 2023-03-03 07:03:18 +00:00
Sergei Zharinov 8cd9f43cbc fix(datasource/packagist): Support for obsolete SHA1 hashes (#20664) 2023-02-28 11:16:51 +00:00
Sergei Zharinov c9fe3b99fa feat(packagist): Support for v2 protocol (#20626) 2023-02-28 09:31:16 +00:00
Sergei Zharinov e97cde57dd refactor(packagist): Reorganize datasource methods (#20595) 2023-02-25 19:33:47 +00:00
Sergei Zharinov fd200d4198 refactor(packagist): Refactor RegistryMeta to inferred via schema (#20592) 2023-02-24 05:55:04 +00:00
Sergei Zharinov edef60045c feat(schema): Add looseValue and looseObject helpers (#20576) 2023-02-22 14:45:26 +00:00
Sergei Zharinov 84e50dc3eb refactor(packagist): Use catch-all schema for releases fields (#20401) 2023-02-14 16:37:31 +00:00
Sergei Zharinov 2336161d05 fix(packagist): Use schema for extractDepReleases method (#20034) 2023-02-05 08:20:07 +01:00
Sergei Zharinov 571d62abf9 fix: Revert "refactor(packagist): Improve fetch concurrency (#19981)" (#20021) 2023-01-24 16:57:32 +00:00
Sergei Zharinov f170c71930 refactor(packagist): Improve fetch concurrency (#19981)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-01-23 17:30:21 +00:00
Sergei Zharinov ca66adabdb refactor(packagist): Use schema for packages.json file (#19930) 2023-01-23 11:52:16 +03:00
Sergei Zharinov ef174ceba5 feat(packagist): Extract PHP constraints (#19875)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-01-17 11:04:50 +01:00
Sergei Zharinov bf6ac7d7a9 fix(packagist): De-minify fields (#19863) 2023-01-17 10:41:59 +01:00
Sergei Zharinov 6679d7ed9b refactor(packagist): Refactor schema (#19868) 2023-01-17 05:47:02 +01:00
Sergei Zharinov c9e308f04b refactor(packagist): Type checked Packagist lookups (#19834)
Fixes undefined
2023-01-15 16:58:42 +01:00
Rhys Arkins 5917c548a6 fix(datasource/packagist): Revert "refactor(composer): Simplify Packagist lookups" (#19824) 2023-01-13 12:05:32 +01:00
Sergei Zharinov 4b2f376393 refactor(composer): Simplify Packagist lookups (#19808) 2023-01-12 18:23:53 +01:00