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

False positive: Unused import & Swift Macros #863

Open
jfiser-paylocity opened this issue Jan 6, 2025 · 0 comments
Open

False positive: Unused import & Swift Macros #863

jfiser-paylocity opened this issue Jan 6, 2025 · 0 comments

Comments

@jfiser-paylocity
Copy link

Issue

Periphery reports false positive on unused imports even though they are required for project compilation. The issue probably is that only generated code from custom Swift Macros is referenced in these cases.

We have also tried to ignore this specific import via comment command ignore but that does not seem to work on import statements.

Is there anything we are missing please?

Example

ModuleA

@SwiftMacrosTest
protocol SomeProtocol { ... }

// Generated code:
// class SomeProtocolTest: SomeProtocol { ... }

ModuleB

// periphery:ignore - This has no effect on import statements
import ModuleA // <-- Gets reported as unused

class Tests: XCTestCase {
    func test() {
        let instance = SomeProtocolTest()
        ...
    }
}

Environment

periphery: 3.0.1 (launched from CLI via mint run periphery scan)
Xcode: 16.2

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

No branches or pull requests

1 participant