Commit Graph

12 Commits

Author SHA1 Message Date
Sebastian Poxhofer a473e73b3e fix(linters): forbid inert counts in v8 coverage-ignore comments (#45287)
Adds a custom oxlint rule renovate/v8-ignore-no-count that flags the
count form '/* v8 ignore next <N> */'. The count is not honored by
vitest's ast-v8-to-istanbul hint parser, which captures only the
keyword (if/else/next/file); 'next' always exempts exactly the next
AST node. Trailing counts therefore suggest a line range that is never
applied and mislead readers.

The rule is autofixable (drops the count, preserving actual behavior)
and has been applied to all existing occurrences.
2026-08-22 11:25:31 +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
Jamie Tanna 5cc5fa6ba7 chore: log a warning when logger isn't initialized (yet) (#41843)
In an alternative to #41842, we can also introduce a warning when the
logger has been called before any initialization, as a way to surface
this misconfiguration.
2026-03-12 13:08:51 +00:00
Michael Kriese e438887dfb build: lazy load and initialize logger (#41425)
* build: lazy load initialization modules

* build: lazy load and initialize logger

* chore: lint fix

* Update lib/constants/error-messages.ts

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>

* Apply suggestion

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>

---------

Co-authored-by: Jamie Tanna <jamie.tanna@mend.io>
2026-03-10 16:57:29 +00:00
Jamie Tanna 938829d5f4 feat(logger): take function parameters into account for deduplication (#41333)
* feat(logger): take function parameters into account for deduplication

Previously, the `log.once` call would only take into account the "call
site" of the file + line number.

However, we have areas in the codebase (currently, and as part of future
changes) where we need to be able to call the `logger.once` functions
from the same line, but with different parameters.

We then need to make sure that the parameters are correctly passed in to
our `logOnceFn`, so we can then use them.

We use `safe-stable-stringify` to provide a more performant means to
stringify, and then hash the result to avoid large keys.

Because the `logger.once` should only be used with our logger, we can
also make the parameters required, and update tests accordingly.

Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>

* refactor: use explicit node import

Co-authored-by: Michael Kriese <michael.kriese@visualon.de>

---------

Co-authored-by: Claude Sonnet 4.5 <jamie.tanna+github-copilot@mend.io>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-20 10:54:54 +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 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
Gabriel-Ladzaretti 120bd83699 feat(logger): support custom serializers (#39019) 2025-11-02 15:00:52 +00:00
Michael Kriese b5ff90f2bd fix: improve coverage (#34667) 2025-03-06 17:05:19 +00:00
Michael Kriese bb5377b3d8 test: fix code coverage (#34495) 2025-02-26 12:40:30 +00:00
Gabriel-Ladzaretti 3b9464c8fa refactor(logger): improve readability and modularity (#33058)
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-17 09:24:57 +00:00