Skip to content

False positive with environment variable with property wrapper seen as never used (@Environment) #1121

@pylapp

Description

@pylapp

Describe the bug

This is a regression of #993

Reproduction

Given the following Swift file, there are some false positive warnings for environment variable:

  • verticalSizeClass
  • horizontalSizeClass

The logs:

[11:23:26]: $ cd .. && periphery scan --relative-results --format xcode
[11:23:26]: ▸ warning: .periphery.yml: invalid key 'targets'
[11:23:27]: ▸ * Building...
[11:24:17]: ▸ * Indexing...
[11:24:19]: ▸ * Analyzing...
[11:24:20]: ▸ OUDS/Core/Components/Sources/Controls/PinCodeInput/Internal/PinCodeInputContainer.swift:44:51: warning: Unused property 'verticalSizeClass'
[11:24:20]: ▸ OUDS/Core/Components/Sources/Controls/PinCodeInput/Internal/PinCodeInputContainer.swift:45:53: warning: Unused property 'horizontalSizeClass'

Environment

Copy the output from running:

> periphery version
3.7.4
> swift -version
swift-driver version: 1.148.6 Apple Swift version 6.3.1 (swiftlang-6.3.1.1.2 clang-2100.0.123.102)
Target: arm64-apple-macosx26.0
> xcodebuild -version
Xcode 26.4.1
Build version 17E202

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    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