Skip to content

--retain-public & retain_public: true in .periphery.yaml don't seem to work for public macro #1131

Description

@rgoldberg

Describe the bug

--retain-public, retain_public: true in .periphery.yaml & // periphery:ignore don't seem to work for public macro.

Reproduction

I get warning: Unused macro '…' for public macro declarations.

@attached(extension)
public macro PeripheryTest() =
	#externalMacro(module: "SwiftArgumentParserConfigurationMacros", type: "SCPropertyDefaultsMacro")

I don't have a full reproduction SwiftPM project now, as that will take time to distill from my actual project.

If you need a reproduction project, I can share my new project once its initial version is ready to be published, or maybe whittle down an example.

$ periphery scan --retain-public
Sources/SwiftArgumentParserConfiguration/Test.swift:2:14: warning: Unused macro 'PeripheryTest()'

Environment

$ periphery version
3.7.4

$ swift -version
swift-driver version: 1.148.6 Apple Swift version 6.3.2 (swiftlang-6.3.2.1.108 clang-2100.1.1.101)
Target: arm64-apple-macosx26.0

$ xcodebuild -version
Xcode 26.5
Build version 17F42

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions