Skip to content

Feature request: Lint rule for avoiding unsafe Swift #1083

@a7medev

Description

@a7medev

swift-format already provides rules like NeverForceUnwrap, NeverUseForceTry, and NeverUseImplicitlyUnwrappedOptionals for avoiding Swift features that might crash at runtime.

It'd be great to have a similar rule for avoiding unsafe Swift features like unsafe pointers, unowned(unsafe), nonisolated(unsafe), withUnsafeContinuation, withUnsafeThrowingContinuation, and overflow arithmetic (&+, &-, &*).

We can also include @unchecked Sendable though I'm not entirely sure if it's truly "unsafe" in the sense that it can lead to undefined behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions