Skip to content

fix: rename max param shadowing builtin - #971

Merged
skevetter merged 1 commit into
mainfrom
fix/codefactor/encoding-max-redef
Aug 9, 2026
Merged

skevetter merged 1 commit into
mainfrom
fix/codefactor/encoding-max-redef

Conversation

@devsy-app

@devsy-app devsy-app Bot commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Codefactor fix

Issue Key: 6a77b13d5b1ec0b4ee20c436
File:line: pkg/encoding/encoding.go L51
Codefactor message: "Redefinition of built-in function max"
Category: Maintainability

Problem

SafeConcatNameMax declared a parameter named max, which shadows Go's
built-in max function (available since Go 1.21). Codefactor flags this
as a Maintainability issue because it reduces clarity and can surprise
readers who expect max(...) to resolve to the builtin.

Change

Rename the max parameter to maxLen in SafeConcatNameMax and update
its three uses in the body. This matches the existing alias already used
in pkg/id/id.go (SafeConcatNameMax caller), so naming is consistent
across the call site. No behavioral change.

 func SafeConcatNameMax(name []string, maxLen int) string {
        fullPath := strings.Join(name, "-")
        if len(fullPath) > maxLen {
                ...
                trimmedPath := fullPath[0 : maxLen-6]

Verification

  • task cli:format — passed (golangci-lint fmt)
  • task cli:lint:ci — 0 issues (new-from-patch against origin/main)
  • task cli:test — pkg/encoding PASS; dependent packages
    (pkg/id, pkg/workspace, pkg/provider) PASS. The only full-suite
    failures are the known pre-existing pkg/git TestRepoClone* tests
    and the e2e suite, neither related to this change (no pkg/git or
    e2e files touched).
  • Commit is app-signed and verified (verified=true).

This PR was created by an AI agent as part of an automated daily Codefactor issue fix job.

Codefactor flagged pkg/encoding/encoding.go: SafeConcatNameMax redefines the built-in function max. Rename the parameter (and its uses) to maxLen, matching the existing alias in pkg/id/id.go. No behavior change.
@netlify

netlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 4a689a9
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6a78f9be71b7d800089b6aaf

@devsy-app
devsy-app Bot marked this pull request as ready for review August 9, 2026 22:05
@netlify

netlify Bot commented Aug 9, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 4a689a9
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6a78f9bec4d35600080d4618

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 1 duplication

Metric Results
Complexity 0
Duplication 1

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

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

@skevetter
skevetter merged commit 82517b8 into main Aug 9, 2026
67 checks passed
@skevetter
skevetter deleted the fix/codefactor/encoding-max-redef branch August 9, 2026 22:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant