`explicit_type_interface` not applied within `guard` statements

Open
#6,968 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
swift
Domain
tooling

Research direction

Start by tracing how explicit_type_interface analyzes variable declarations and how the Swift syntax visitor handles guard let bindings; the issue provides a minimal reproducer and a lint command to run. Confirm the sample triggers a violation after the change, and run the rule's related tests to check existing behavior.

Written by the indexing model from the issue text.

Description

New Issue Checklist
Bug Description

The explicit_type_interface rule is not applied within guard statements.

guard let x = (nil as Bool?) else { // doesn't trigger a violation
    fatalError()
}
$ swiftlint lint --only-rule explicit_type_interface path/to/file.swift 
Environment
  • SwiftLint version: 0.65.1
Dominant language
Swift
Stars
19.8k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from realm/SwiftLint

All issues in realm/SwiftLint

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.