Discouraged Assert
Prefer assertionFailure()
and/or preconditionFailure()
over assert(false)
- Identifier:
discouraged_assert
- Enabled by default: No
- Supports autocorrection: No
- Kind: idiomatic
- Analyzer rule: No
- Minimum Swift compiler version: 5.0.0
- Default configuration:
Key Value severity warning
Non Triggering Examples
assert(true)
assert(true, "foobar")
assert(true, "foobar", file: "toto", line: 42)
assert(false || true)
XCTAssert(false)
Triggering Examples
↓assert(false)
↓assert(false, "foobar")
↓assert(false, "foobar", file: "toto", line: 42)
↓assert( false , "foobar")