Skip to content

fix: detect default branch in scalafmt when base_branch is not set - #257

Merged
lolgab merged 2 commits into
masterfrom
fix/scalafmt-detect-base-branch
Nov 6, 2026
Merged

lolgab merged 2 commits into
masterfrom
fix/scalafmt-detect-base-branch

Conversation

@lolgab

@lolgab lolgab commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

scalafmt failed on repos whose default branch is not master:

fatal: couldn't find remote ref master

base_branch now defaults to empty. When empty, the default branch is detected with git ls-remote --symref origin HEAD. Setting base_branch explicitly still overrides detection. The step fails with a clear message if detection returns nothing.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: first review requested successfully. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

@codacy-production codacy-production Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

✅ No blocking issues noticed

No blocking findings were identified. Automated coverage for the new branch-detection paths is still recommended.

Test suggestions

  • Verify automatic detection obtains the default branch and uses it for skipping and diff calculation.
  • Verify an explicitly configured base branch bypasses automatic detection.
  • Verify empty detection output causes failure with the documented error message.
Prompt proposal for missing tests
Consider implementing these tests if applicable:
1. Verify automatic detection obtains the default branch and uses it for skipping and diff calculation.
2. Verify an explicitly configured base branch bypasses automatic detection.
3. Verify empty detection output causes failure with the documented error message.

Make this review better

TIP Add a ticket key to the branch or title so the reviewer can check the PR against it. Or tell us which ticket tracker you use here.
TIP Add Codacy review.md instructions or an AGENTS.md so the reviewer knows your conventions.

TIP How was this review? Give us feedback

@lolgab
lolgab enabled auto-merge (squash) November 6, 2026 08:20
@lolgab
lolgab merged commit a6fab6d into master Nov 6, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants