Skip to content
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

Rule Request: [duplicate_target_in_package] #4805

Open
2 tasks done
skydivedan opened this issue Mar 10, 2023 · 0 comments
Open
2 tasks done

Rule Request: [duplicate_target_in_package] #4805

skydivedan opened this issue Mar 10, 2023 · 0 comments
Labels
rule-request Requests for a new rules.

Comments

@skydivedan
Copy link

skydivedan commented Mar 10, 2023

New Issue Checklist

New rule request

This rule would warn about duplicate targets in a Package.swift file.

Violation:

let package = Package(
    name: "MyPackage",
    platforms: [.iOS(.v14)],
    products: [
        .library(
            name: "MyPackage",
            targets: [
                "BigDependency",
                "SmallDependency",
                "OtherDependency",
                "BigDependency"
            ]),
    ],

Non-violation

let package = Package(
    name: "MyPackage",
    platforms: [.iOS(.v14)],
    products: [
        .library(
            name: "MyPackage",
            targets: [
                "BigDependency",
                "SmallDependency",
                "OtherDependency"
            ]),
    ],

I've seen this problem occur usually when there are two people working on the same swift package. One of them adds a dependency. And the other adds another, and then the branches are merged. It isn't flagged as a problem by the compiler, but can cause issues.

@SimplyDanny SimplyDanny added the rule-request Requests for a new rules. label Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule-request Requests for a new rules.
Projects
None yet
Development

No branches or pull requests

2 participants