Comma Inheritance Rule

Use commas to separate types in inheritance lists

  • Identifier: comma_inheritance
  • Enabled by default: No
  • Supports autocorrection: Yes
  • Kind: style
  • Analyzer rule: No
  • Minimum Swift compiler version: 5.0.0
  • Default configuration:
    KeyValue
    severity warning

Non Triggering Examples

struct A: Codable, Equatable {}
enum B: Codable, Equatable {}
class C: Codable, Equatable {}
protocol D: Codable, Equatable {}
typealias E = Equatable & Codable
func foo<T: Equatable & Codable>(_ param: T) {}
protocol G {
    associatedtype Model: Codable, Equatable
}

Triggering Examples

struct A: Codable & Equatable {}
struct A: Codable  & Equatable {}
struct A: Codable&Equatable {}
struct A: Codable& Equatable {}
enum B: Codable & Equatable {}
class C: Codable & Equatable {}
protocol D: Codable & Equatable {}
protocol G {
    associatedtype Model: Codable & Equatable
}