Move method (#4238)
This commit is contained in:
parent
a4c46f624d
commit
c6eec8072c
|
@ -63,31 +63,13 @@ public final class SwiftLintFile {
|
|||
func markAsTestFile() {
|
||||
isTestFile = true
|
||||
}
|
||||
|
||||
/// Returns whether or not the file contains any attributes that require the Foundation module.
|
||||
func containsAttributesRequiringFoundation() -> Bool {
|
||||
guard contents.contains("@objc") else {
|
||||
return false
|
||||
}
|
||||
|
||||
func containsAttributesRequiringFoundation(dict: SourceKittenDictionary) -> Bool {
|
||||
let attributesRequiringFoundation = SwiftDeclarationAttributeKind.attributesRequiringFoundation
|
||||
if !attributesRequiringFoundation.isDisjoint(with: dict.enclosedSwiftAttributes) {
|
||||
return true
|
||||
} else {
|
||||
return dict.substructure.contains(where: containsAttributesRequiringFoundation)
|
||||
}
|
||||
}
|
||||
|
||||
return containsAttributesRequiringFoundation(dict: structureDictionary)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Hashable Conformance
|
||||
|
||||
extension SwiftLintFile: Hashable {
|
||||
extension SwiftLintFile: Equatable, Hashable {
|
||||
public static func == (lhs: SwiftLintFile, rhs: SwiftLintFile) -> Bool {
|
||||
return lhs.id == rhs.id
|
||||
lhs.id == rhs.id
|
||||
}
|
||||
|
||||
public func hash(into hasher: inout Hasher) {
|
||||
|
|
|
@ -275,4 +275,22 @@ private extension SwiftLintFile {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns whether or not the file contains any attributes that require the Foundation module.
|
||||
func containsAttributesRequiringFoundation() -> Bool {
|
||||
guard contents.contains("@objc") else {
|
||||
return false
|
||||
}
|
||||
|
||||
func containsAttributesRequiringFoundation(dict: SourceKittenDictionary) -> Bool {
|
||||
let attributesRequiringFoundation = SwiftDeclarationAttributeKind.attributesRequiringFoundation
|
||||
if !attributesRequiringFoundation.isDisjoint(with: dict.enclosedSwiftAttributes) {
|
||||
return true
|
||||
} else {
|
||||
return dict.substructure.contains(where: containsAttributesRequiringFoundation)
|
||||
}
|
||||
}
|
||||
|
||||
return containsAttributesRequiringFoundation(dict: structureDictionary)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue