Skip to content

fix: make linter happy #963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025
Merged

fix: make linter happy #963

merged 1 commit into from
May 30, 2025

Conversation

dbarrosop
Copy link
Member

@dbarrosop dbarrosop commented May 30, 2025

PR Type

Other


Description

• Refactor Docker host parsing into separate function
• Fix import ordering to satisfy linter requirements
• Add error handling with nolint directive
• Extract reusable logic from traefik function


Changes walkthrough 📝

Relevant files
Enhancement
compose.go
Refactor Docker host parsing and fix imports                         

dockercompose/compose.go

• Move net/url import to proper alphabetical position
• Extract Docker
host parsing logic into getDockerHost() function
• Add nolint
directive for custom error creation
• Improve error handling and code
organization

+23/-12 

Need help?
  • Type /help how to ... in the comments thread for any questions about PR-Agent usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Error Handling

    The nolint directive for err113 suggests suppressing a linter warning about error creation. This should be validated to ensure the error handling approach is appropriate and the suppression is justified.

    	return "", fmt.Errorf( //nolint:err113
    		"unsupported scheme %s in DOCKER_HOST, only unix supported",
    		u.Scheme,
    	)
    }

    Copy link
    Contributor

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Fix error message formatting

    The error message formatting is inconsistent with Go conventions. Use a single line
    for the error message to improve readability and maintain consistency with other
    error messages in the codebase.

    dockercompose/compose.go [219-223]

    -return "", fmt.Errorf( //nolint:err113
    -    "unsupported scheme %s in DOCKER_HOST, only unix supported",
    -    u.Scheme,
    -)
    +return "", fmt.Errorf("unsupported scheme %s in DOCKER_HOST, only unix supported", u.Scheme) //nolint:err113
    Suggestion importance[1-10]: 4

    __

    Why: The suggestion correctly identifies a minor formatting inconsistency in the error message. While the improvement enhances readability by using a single line format, it's a minor stylistic change with low impact on functionality.

    Low

    @dbarrosop dbarrosop merged commit 2eb145f into main May 30, 2025
    10 checks passed
    @dbarrosop dbarrosop deleted the build-fix branch May 30, 2025 10:41
    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.

    2 participants