Commit Graph

75 Commits

Author SHA1 Message Date
Sebastian Poxhofer 3412de84ce refactor(linters): enable oxlint rule prefer-named-capture-group (#44714)
* refactor(lint): enable oxlint prefer-named-capture-group at error

Numbered capture groups (m[1], $1) break silently when a regex is
edited and group order shifts. Named groups (?<name>...) make intent
explicit and accesses (m.groups.name) resilient to reordering.

This enables the built-in eslint rule prefer-named-capture-group,
surfacing 321 pre-existing unnamed-group violations across ~121
files to be burned down incrementally in follow-up commits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(versioning): name capture groups for prefer-named-capture-group

Burns down all prefer-named-capture-group violations in
lib/modules/versioning/. Unused capture groups (only reachable via
.test() or whole-match) become non-capturing (?:...); groups whose
value is read become named (?<name>...), with accesses rewritten to
match.groups!.<name> (or destructured from .groups!) instead of
positional match[n]/$n so a future edit that reorders groups cannot
silently break the reader.

Two cases needed extra care to preserve behavior:
- semver/common.ts and poetry/patterns.ts split() on a regex whose
  capture group is relied upon by String.prototype.split to keep the
  separator in the output array; the group is kept capturing and
  named, not converted to non-capturing.
- hashicorp/convertor.ts's semverRegex is only ever embedded via
  .source into a named `(?<version>...)` group elsewhere and never
  matched directly, so its internal groups are safe to make
  non-capturing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(datasource): name capture groups for prefer-named-capture-group

Burns down all prefer-named-capture-group violations under
lib/modules/datasource/. Same treatment as the versioning module:
unused groups become non-capturing, used groups get names, and
positional match[n] reads move to match.groups!.<name>.

docker/ecr.ts and pypi/common.ts keep their positional destructuring
(`const [, region] = ...`, `!!m &&`) working unchanged since a named
capture group is still addressable by its numeric index in
JavaScript — only pypi/common.ts's access was rewritten to
m.groups!.owner for clarity since it read a single group directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(platform): name capture groups for prefer-named-capture-group

Burns down all prefer-named-capture-group violations under
lib/modules/platform/. Uses the repo's established idiom of
`match.groups?.<name>` after an optional-chained exec()/match() (see
bitbucket/index.ts hostnameWithoutApiPrefix, gerrit/utils.ts
extractSourceBranch) and `$<name>` in String.replace replacement
strings. Unused groups (markdown/HTML massaging regexes matched only
to be stripped) become non-capturing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(manager): name capture groups in ansible-galaxy for prefer-named-capture-group

Burns down prefer-named-capture-group violations in
lib/modules/manager/ansible-galaxy/. newBlockRegEx and blockLineRegEx
dropped their unused outer wrapping group (only the inner key/value
groups were ever read) and named the key/value groups; nameMatchRegex's
remaining unused groups (protocol/user-info/port alternatives) become
non-capturing since only source/hostname/depName/version are read via
.groups. Accesses in collections.ts and roles.ts move from
lineMatch[2]/lineMatch[3] to lineMatch.groups!.key/value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(manager): name capture groups for prefer-named-capture-group (batch 1)

Burns down prefer-named-capture-group violations across the first
alphabetical slice of lib/modules/manager/ (ansible through mix).
Used groups get names with accesses rewritten to match.groups!.<name>
(or $<name> in replacement strings); groups whose value is never read
become non-capturing (?:...). Two String.split() call sites
(git-submodules/extract.ts, meteor/extract.ts) keep the established
"named group still readable positionally from the split() result
array" idiom instead of restructuring the destructuring.

bazel/rules/go.ts and buildpacks/extract.ts dockerRef verified
byte-for-byte equivalent before/after via a quick node script since
several nested groups collapsed to non-capturing at once.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(manager): name capture groups for prefer-named-capture-group (batch 2)

Burns down prefer-named-capture-group violations across the remaining
alphabetical slice of lib/modules/manager/ (npm through terragrunt).
Same treatment as batch 1: used groups get names with accesses moved
to match.groups!.<name> or $<name> replacement strings; unused groups
(wrapping alternations, quantifier repetition groups only consumed via
.test(), or values never read from a match) become non-capturing.

terraform/extractors/others/modules.ts and terragrunt/modules.ts share
near-identical URL-parsing regexes (github/bitbucket/git/azure-devops
ref matchers) — the same set of always-unused `depth=`/`&depth=`
query-string groups is converted to non-capturing in both files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(config): name capture groups for prefer-named-capture-group

Burns down prefer-named-capture-group violations in lib/config/.
Used groups get names with replacement strings switched from $1/$2 to
$<name>; the unused separator group in schedule-migration.ts's
afterBeforeRegex becomes non-capturing. presets/parse.ts keeps
assigning through the already-declared `repo` variable rather than
array-destructuring the exec() result, matching this file's existing
style for the other named-group regexes just above it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(util): name capture groups for prefer-named-capture-group

Burns down prefer-named-capture-group violations across lib/util/ and
lib/logger/. Same treatment as previous batches: named groups for
values that are read (via $<name> replacement strings, .groups!.<name>,
or destructured from .groups), non-capturing groups where nothing reads
the captured value (e.g. semantic.ts's angular-commit .test()-only
regex). www-authenticate.ts's tokenizer entries each get their own
named group but keep accessing the match generically via match[1],
since a positionally-indexed named group is still readable by index.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(workers): name capture groups for prefer-named-capture-group

Burns down prefer-named-capture-group violations in lib/workers/.
Used groups get names with $<name> replacement strings; unused
wrapper/alternation groups (e.g. semantic-commit-message.ts's optional
scope/issue wrappers, release-notes.ts's date-heading and
horizontal-rule matchers that are only probed with .search()/replaced
wholesale) become non-capturing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* refactor(test,tools): name capture groups for prefer-named-capture-group

Finishes the prefer-named-capture-group burndown: test/, tools/, and
vitest.config.mts. Groups whose value is read get names ($<name>
replacement strings or .groups.<name> access); groups only used via
.test()/.search() or that feed a .match(/…/g) call (whose return value
is the array of whole matches, not captured groups) become
non-capturing.

This is the last remaining slice of pre-existing violations, so the
rule (already enabled at error repo-wide) now passes with zero
findings across the whole codebase.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017RxHFNsSworLcv23xXk9Hk

* fix prettier failure

* refactor(lint): use a named capture group in `v8-ignore-no-count`

New rule from main trips the newly enabled `prefer-named-capture-group` oxlint rule.

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-03 09:54:40 +00:00
Simon Marquis c77ac1f29c fix(gradle): collision with well-known Android APIs (#45350)
Discussion: https://github.com/renovatebot/renovate/discussions/45349
2026-08-19 13:46: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 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
Johannes Feichtner 4dbfc7a53c feat(manager/gradle): add support for implicit version catalog accessor syntax (#42746)
* feat(manager/gradle): add support for implicit version catalog accessor syntax

* fix coverage in else branches
2026-04-20 12:58:25 +00:00
Johannes Feichtner c06b551b6c feat(gradle): add support for short dependency notation in version catalogs (#41797) 2026-03-11 13:12:51 +00:00
Johannes Feichtner 544fcfb120 fix(gradle): skip exclusiveContent registries if all filters are invalid or unsupported (#41742) 2026-03-09 10:14:06 +00:00
Johannes Feichtner 4312453b6a fix(gradle): prevent 'registryUrl' token not found error while parsing Gradle files (#41600) 2026-03-02 16:50:14 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +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
Sergei Zharinov ae49b7af38 chore(deps): switch to @renovatebot/good-enough-parser (#40623)
* chore(deps): switch to @jrnv/good-enough-parser

* chore(deps): switch to @renovatebot/good-enough-parser

* chore(deps): update @renovatebot/good-enough-parser to 1.2.0
2026-01-26 12:44:11 +00:00
Johannes Feichtner 74401317ec refactor(manager/gradle): rewrite reorderFiles() for performance (#40318) 2026-01-23 18:44:14 +00:00
Johannes Feichtner 4392c1c758 fix(manager/gradle): ignore DependencySubstitution modules (#39965) 2025-12-28 09:39:02 +00:00
Johannes Feichtner 96a7d27350 feat(manager/gradle): add support for variables in plugin names (#39002) 2025-11-11 14:00:37 +00:00
Trask Stalnaker bcbc7b5e7e feat(gradle): support useJUnitJupiter under suites.withType (#38326)
* Support useJUnitJupiter under suites.withType

* unify

* fix: change withType maxDepth from 2 to 1

Addresses review comment from @Churro about maxDepth: 2 being too permissive.
With maxDepth: 1, the withType tree will only match:
- withType(JvmTestSuite)
- withType(JvmTestSuite::class)

This prevents unintended matching of nested structures like withType([...])
which are not valid Gradle syntax for this use case and are not covered by tests.

* refactor: merge test suite queries using q.alt pattern
2025-10-08 15:31:13 +00:00
Sebastian Poxhofer 14a76f4a05 feat(manager/gradle): add "const val" version resolution (#37837) 2025-09-04 14:14:14 +00:00
Johannes Feichtner 4137244b4e feat(gradle): add support for exclusiveContent() repository definitions (#35421) 2025-04-17 13:44:30 +00:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
Johannes Feichtner 5658777d7a refactor(gradle): unify handling of custom and predefined registry URLs (#34714) 2025-03-12 10:15:08 +00:00
Ivan Panaev 918df4c8b4 fix(manager/gradle): qGroovySingleMapOfVarAssignment and qGroovyMapOfExpr str format var name support (#34682) 2025-03-09 07:00:00 +00:00
renovate[bot] 55845508b6 chore(deps): update eslint monorepo to v9 (major) (#33573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-20 11:31:13 +00:00
Johannes Feichtner aae045edf5 feat(gradle): add support for gradle repository content descriptors (#33692)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-04 17:16:51 +00:00
Johannes Feichtner abb00a702b feat(gradle): add support for implicit test suite dependencies (#33775) 2025-01-27 07:48:22 +00:00
Rhys Arkins 0c2eaaf8bb feat: sharedVariableName (#33111)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-01-16 15:05:07 +00:00
Johannes Feichtner 6ff935ef0b fix(gradle): remove redundant checks and parser statements (#33526) 2025-01-11 13:16:00 +00:00
Johannes Feichtner 6cf23f2bf1 refactor(gradle): extract redundant functions and remove snapshot (#33430) 2025-01-09 07:22:45 +00:00
Johannes Feichtner 6e8b70ed07 fix(gradle): correct handling of heuristically matched dependency triples (#33487) 2025-01-08 22:14:44 +00:00
Johannes Feichtner 80faed3ffe fix(gradle): avoid heuristic matching of gradle feature variant capabilities (#33438) 2025-01-07 06:53:48 +00:00
Johannes Feichtner 0ff6e98493 feat(gradle): add support for java.toolchain.languageVersion detection in build.gradle(.kts) files (#32461) 2024-11-21 11:16:25 +00:00
Sebastian Poxhofer 3681b2a945 chore: eslint to enforce for typed imports (#30844) 2024-08-19 13:15:27 +00:00
renovate[bot] eb8c08079e chore(deps): update typescript-eslint monorepo to v8 (major) (#30750)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-08-14 10:33:02 +00:00
renovate[bot] 1a1e1acc23 chore(deps): update dependency typescript to v5.5.3 (#29906)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-07-20 20:38:33 +00:00
Johannes Feichtner b4189c8093 feat(manager/gradle): add support for dep matching in lists that are nested in Groovy maps (#28517) 2024-04-19 04:20:46 +00:00
renovate[bot] cbef575a2c chore(deps): update linters to v6.20.0 (#26925)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2024-02-12 09:09:29 +00:00
Johannes Feichtner d59316e1d1 fix(manager/gradle): fix potential parsing error for plugins in inlined version catalogs (#26737) 2024-01-19 03:14:19 +00:00
Johannes Feichtner da8396e384 feat(manager/gradle): add support for micronaut plugin (#26519) 2024-01-06 08:01:31 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Johannes Feichtner a57cdfdb85 feat(manager/gradle): add support for Kotlin import directives (#25486) 2023-10-28 21:53:31 +00:00
Johannes Feichtner b8e1826868 feat(manager/gradle): add support for listOf directives in Kotlin objects (#24367) 2023-09-12 01:00:43 +00:00
Rhys Arkins 36e2b328bb chore: update types reference 2023-08-15 11:31:15 +02:00
Sergei Zharinov 53263bbfda feat: Clone objects via wrapper (#22970) 2023-06-27 13:09:59 +00:00
Johannes Feichtner edb9518bf8 fix(manager/gradle): extend allowed nesting depth for Kotlin objects from 3 to 4 (#22959) 2023-06-24 16:51:04 +00:00
Ryo Matsukawa 0417c111ac refactor: Merged multiple skipReasons into unspecified-version. (#22409) 2023-05-25 05:48:11 +00:00
Johannes Feichtner eec46d1880 feat(gradle/manager): add support for Kotlin objects in buildSrc files (#21892) 2023-05-10 19:36:05 +00:00
guicamest 2112ea2646 feat(manager/gradle): Support properties map in gradle kts (#21792) 2023-05-07 15:47:06 +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
Sergei Zharinov 6bd1277c89 fix(manager/gradle): Filter false positives out of extracted deps (#21753) 2023-04-23 08:33:49 +02:00
Johannes Feichtner 94b42c5123 refactor(gradle/manager): introduce method to resolve variables (#21531) 2023-04-17 06:13:31 +00:00
Johannes Feichtner b088733066 fix(manager/gradle): resolve values when assigning symbols to variables (#21411) 2023-04-10 16:37:46 +00:00
Johannes Feichtner f0b74b8f75 fix(manager/gradle): handle dot as optional when parsing plugins in Kotlin DSL (#21362) 2023-04-05 20:05:34 +00:00