Skip to content

fix: Duplicate path expansion logic#163

Open
mrwind-up-bird wants to merge 2 commits intoSimplyLiz:developfrom
mrwind-up-bird:autofix/b3cf0967/duplicate-path-expansion-logic
Open

fix: Duplicate path expansion logic#163
mrwind-up-bird wants to merge 2 commits intoSimplyLiz:developfrom
mrwind-up-bird:autofix/b3cf0967/duplicate-path-expansion-logic

Conversation

@mrwind-up-bird
Copy link
Collaborator

AutoFix: Duplicate path expansion logic

Category: code-smell
Severity: low

Issue

The expandPath function duplicates standard library functionality for tilde expansion that could be handled by os.UserHomeDir() directly, adding unnecessary complexity.

Fix

Simplified the expandPath function by removing the duplicate error handling and prefix check. The filepath.Join function handles the case where home is empty (returns the original path), and strings.TrimPrefix safely handles paths that don't start with "~/" by returning them unchanged. This eliminates the unnecessary complexity while maintaining the same functionality.


Generated by nyxCore AutoFix

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.

2 participants