No Grouping Extension

Extensions shouldn’t be used to group code within the same source file

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

Non Triggering Examples

protocol Food {}
extension Food {}
class Apples {}
extension Oranges {}
class Box<T> {}
extension Box where T: Vegetable {}

Triggering Examples

enum Fruit {}
extension Fruit {}
extension Tea: Error {}
struct Tea {}
class Ham { class Spam {}}
extension Ham.Spam {}
extension External { struct Gotcha {}}
extension External.Gotcha {}