         ]
     )
 
+    // swiftlint:disable:next function_body_length
     public func validate(file: File) -> [StyleViolation] {
-        guard let mainTypeSubstructure = mainTypeSubstructure(in: file) else { return [] }
+        guard let mainTypeSubstructure = mainTypeSubstructure(in: file),
+            let mainTypeSubstuctureOffset = mainTypeSubstructure.offset else { return [] }
 
         let extensionsSubstructures = self.extensionsSubstructures(
             in: file,

        supportingTypeKinds.insert(SwiftDeclarationKind.protocol)

        return file.structure.dictionary.substructure.filter { substructure in
            guard let declarationKind = SwiftDeclarationKind(rawValue: substructure.kind!) else { return false }
            return substructure.bridge() != mainTypeSubstructure.bridge() &&
                supportingTypeKinds.contains(declarationKind)
        }

        mainTypeSubstructure: [String: SourceKitRepresentable]
    ) -> [[String: SourceKitRepresentable]] {
        return file.structure.dictionary.substructure.filter { substructure in
            guard let kind = substructure.kind else { return false }
            return substructure.bridge() != mainTypeSubstructure.bridge() &&
                kind.contains(SwiftDeclarationKind.extension.rawValue)
        }
    }

