Repository navigation
fix: rename max param shadowing builtin - #971
Merged
Merged
Conversation
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.
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 1 |
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.
TIP This summary will be updated as you push new changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Codefactor fix
Issue Key:
6a77b13d5b1ec0b4ee20c436File:line:
pkg/encoding/encoding.goL51Codefactor message: "Redefinition of built-in function max"
Category: Maintainability
Problem
SafeConcatNameMaxdeclared a parameter namedmax, which shadows Go'sbuilt-in
maxfunction (available since Go 1.21). Codefactor flags thisas a Maintainability issue because it reduces clarity and can surprise
readers who expect
max(...)to resolve to the builtin.Change
Rename the
maxparameter tomaxLeninSafeConcatNameMaxand updateits three uses in the body. This matches the existing alias already used
in
pkg/id/id.go(SafeConcatNameMaxcaller), so naming is consistentacross the call site. No behavioral change.
Verification
task cli:format— passed (golangci-lint fmt)task cli:lint:ci— 0 issues (new-from-patch against origin/main)task cli:test—pkg/encodingPASS; dependent packages(
pkg/id,pkg/workspace,pkg/provider) PASS. The only full-suitefailures are the known pre-existing
pkg/gitTestRepoClone*testsand the
e2esuite, neither related to this change (nopkg/gitore2efiles touched).verified=true).This PR was created by an AI agent as part of an automated daily Codefactor issue fix job.