Skip to content

feat(manager): add rebar3 manager for Erlang dependencies#41887

Closed
Taure wants to merge 5 commits intorenovatebot:mainfrom
Taure:feat/rebar3-manager
Closed

feat(manager): add rebar3 manager for Erlang dependencies#41887
Taure wants to merge 5 commits intorenovatebot:mainfrom
Taure:feat/rebar3-manager

Conversation

@Taure
Copy link
Copy Markdown

@Taure Taure commented Mar 13, 2026

Summary

  • Adds a new rebar3 manager that extracts dependencies from Erlang/OTP rebar.config files and updates rebar.lock files
  • Supports all rebar3 dependency formats: hex packages (with version constraints, bare atoms, pkg overrides), git dependencies (tag/branch/ref), git subdirectory dependencies, and profile-scoped dependencies (test)
  • Reuses existing hex datasource, hex versioning, git-tags and github-tags datasources
  • Adds erlang to the list of manager categories
  • Includes 18 tests across extract, artifacts, and range specs

Dependency formats supported

Format Example
Hex (version) {cowboy, "~> 2.9"}
Hex (pinned) {cowboy, "2.9.0"}
Hex (bare atom) cowboy
Hex (pkg override) {app, {pkg, alt_name}}, {app, "1.0", {pkg, alt_name}}
Git (tag) {app, {git, "url", {tag, "1.0"}}}
Git (branch) {app, {git, "url", {branch, "main"}}}
Git (ref) {app, {git, "url", {ref, "abc123"}}}
Git subdirectory {app, {git_subdir, "url", {tag, "1.0"}, "path"}}
Profile deps {profiles, [{test, [{deps, [...]}]}]}

Files

File Purpose
lib/modules/manager/rebar3/index.ts Manager config and exports
lib/modules/manager/rebar3/extract.ts Parse rebar.config + read rebar.lock
lib/modules/manager/rebar3/artifacts.ts Run rebar3 upgrade to update lock file
lib/modules/manager/rebar3/range.ts Range strategy (update-lockfile/widen)
lib/modules/manager/rebar3/readme.md Manager documentation
lib/constants/category.ts Added erlang category
lib/modules/manager/api.ts Registered rebar3 manager

Test plan

  • extract.spec.ts — 6 tests: invalid files, no deps, all dep formats, locked versions, simple config, commented deps
  • artifacts.spec.ts — 8 tests: skip conditions, lock updates, lockFileMaintenance, error handling, injection prevention
  • range.spec.ts — 4 tests: bump/auto/pin strategies with simple and complex ranges
  • Verified existing manager index tests (153 tests) still pass with new manager registered
  • Verified existing mix manager tests still pass

🤖 Generated with Claude Code and this PR was written primarily by Claude Code.

Add a new manager for Erlang/OTP rebar3 projects that extracts
dependencies from rebar.config and updates rebar.lock files.

Supported dependency formats:
- Hex packages (bare atom, version constraint, pinned, pkg override)
- Git dependencies (tag, branch, ref)
- Git subdirectory dependencies
- Profile dependencies (test profile)

Uses existing hex datasource, hex versioning, git-tags and
github-tags datasources.
@github-actions github-actions Bot requested a review from viceice March 13, 2026 11:03
@cla-assistant
Copy link
Copy Markdown

cla-assistant Bot commented Mar 13, 2026

CLA assistant check
All committers have signed the CLA.

Taure and others added 4 commits March 13, 2026 12:12
- Add 'erlang' to CategoryNames in tools/docs/manager.ts (fixes type error)
- Add tests covering error paths, edge cases, and keyword filtering
- Improve line coverage to 98%+ across all rebar3 manager files
Add tests for nested bracket tracking in deps section parsing
to achieve 100% line/statement coverage on extract.ts.
- Add test for undefined currentValue in range strategy
- Add test for lock entries not matching extracted deps
- Add test for parent lock path existing but file not present
- Add v8 ignore for unreachable nullish coalescing branch
@Taure
Copy link
Copy Markdown
Author

Taure commented Mar 20, 2026

Closing in favor of a split into 3 smaller, reviewable PRs:

  1. feat(manager): add rebar3 manager for Erlang dependency extraction #42025 — Core extraction (rebar.config parsing + rebar.lock reading)
  2. feat(manager): add rebar3 lock file and artifact support #42026 — Lock file / artifact support (rebar3 upgrade)
  3. feat(manager): add rebar3 range strategy support #42027 — Range strategy support

Each PR builds on the previous one.

@Taure Taure closed this Mar 20, 2026
Copy link
Copy Markdown
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mock file system instead

import * as puppet from './puppet/index.ts';
import * as pyenv from './pyenv/index.ts';
import * as quadlet from './quadlet/index.ts';
import * as rebar3 from './rebar3/index.ts';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why rebar3 instead of rebar? do you expect a new manager if rebar 4 comes out? we usually don't encode the version into the manager name.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please inline the fixtures into the test with codeBlock template helper.

return null;
}

let lockFileName = getSiblingFileName(packageFileName, 'rebar.lock');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not simply use find sibling or parent here?

];
}

if (!existingLockFileContent) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this before the try-catch above (perf)

toolConstraints: [
{
toolName: 'erlang',
constraint: config.constraints?.erlang ?? '^26',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
constraint: config.constraints?.erlang ?? '^26',
constraint: config.constraints?.erlang,

why v26 here, Renovate should resolve latest if not explicit restricted?

try {
await exec(command, execOptions);
} catch (err) {
/* v8 ignore next 3 */
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add test instead

Suggested change
/* v8 ignore next 3 */

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants