Skip to content

ignore_swiftui_view_bodies false positive in conditions #6255

@rd-david-wahlandt

Description

@rd-david-wahlandt

New Issue Checklist

Bug Description

When configuring redundant_discardable_let with ignore_swiftui_view_bodies: true the rule still emits a warning when the let _ = is inside condition:

// This triggers a violation:
@ViewBuilder func makeView() -> some View {
    if true {
        let _ = assertionFailure("This should not trigger")
    }
}

Mention the command or other SwiftLint integration method that caused the issue. Include stack traces or command output.

$ swiftlint lint [--no-cache] [--fix]

Environment

  • SwiftLint version: 0.61.0
  • Xcode version: 16.4
  • Installation method used: Mint
  • Configuration file:
redundant_discardable_let:
  ignore_swiftui_view_bodies: true

Metadata

Metadata

Assignees

Labels

bugUnexpected and reproducible misbehavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions