Get rid of some disabled commands (#4807)
This commit is contained in:
parent
7d7bee5eee
commit
1bf2f25e40
|
@ -47,11 +47,10 @@ extension Configuration {
|
||||||
Self.nestedConfigIsSelfByIdentifierLock.unlock()
|
Self.nestedConfigIsSelfByIdentifierLock.unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next discouraged_optional_boolean
|
internal static func getIsNestedConfigurationSelf(forIdentifier identifier: String) -> Bool {
|
||||||
internal static func getIsNestedConfigurationSelf(forIdentifier identifier: String) -> Bool? {
|
|
||||||
Self.nestedConfigIsSelfByIdentifierLock.lock()
|
Self.nestedConfigIsSelfByIdentifierLock.lock()
|
||||||
defer { Self.nestedConfigIsSelfByIdentifierLock.unlock() }
|
defer { Self.nestedConfigIsSelfByIdentifierLock.unlock() }
|
||||||
return Self.nestedConfigIsSelfByIdentifier[identifier]
|
return Self.nestedConfigIsSelfByIdentifier[identifier] ?? false
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: SwiftLint Cache (On-Disk)
|
// MARK: SwiftLint Cache (On-Disk)
|
||||||
|
|
|
@ -56,9 +56,8 @@ public extension Configuration {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// swiftlint:disable:next discouraged_optional_boolean
|
internal func includesFile(atPath path: String) -> Bool {
|
||||||
internal func includesFile(atPath path: String) -> Bool? {
|
guard isBuilt else { return false }
|
||||||
guard isBuilt else { return nil }
|
|
||||||
|
|
||||||
return vertices.contains { vertix in
|
return vertices.contains { vertix in
|
||||||
if case let .existing(filePath) = vertix.filePath {
|
if case let .existing(filePath) = vertix.filePath {
|
||||||
|
|
|
@ -106,7 +106,7 @@ extension Configuration {
|
||||||
config = self
|
config = self
|
||||||
} else if
|
} else if
|
||||||
FileManager.default.fileExists(atPath: configurationSearchPath),
|
FileManager.default.fileExists(atPath: configurationSearchPath),
|
||||||
fileGraph.includesFile(atPath: configurationSearchPath) != true
|
!fileGraph.includesFile(atPath: configurationSearchPath)
|
||||||
{
|
{
|
||||||
// Use self merged with the nested config that was found
|
// Use self merged with the nested config that was found
|
||||||
// iff that nested config has not already been used to build the main config
|
// iff that nested config has not already been used to build the main config
|
||||||
|
|
|
@ -1,15 +1,8 @@
|
||||||
@testable import SwiftLintFramework
|
@testable import SwiftLintFramework
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
// swiftlint:disable:next balanced_xctest_lifecycle
|
|
||||||
class ExpiringTodoRuleTests: XCTestCase {
|
class ExpiringTodoRuleTests: XCTestCase {
|
||||||
private lazy var config: Configuration = makeConfiguration()
|
private var config: Configuration = makeConfiguration()
|
||||||
|
|
||||||
override func setUp() {
|
|
||||||
super.setUp()
|
|
||||||
|
|
||||||
config = makeConfiguration()
|
|
||||||
}
|
|
||||||
|
|
||||||
func testExpiringTodo() {
|
func testExpiringTodo() {
|
||||||
verifyRule(ExpiringTodoRule.description, commentDoesntViolate: false)
|
verifyRule(ExpiringTodoRule.description, commentDoesntViolate: false)
|
||||||
|
@ -37,7 +30,7 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testNonExpiredTodo() {
|
func testNonExpiredTodo() {
|
||||||
let example = Example("fatalError() // TODO: [\(dateString(for: nil))] Implement")
|
let example = Example("fatalError() // TODO: [\(dateString(for: .badFormatting))] Implement")
|
||||||
XCTAssertEqual(violations(example).count, 0)
|
XCTAssertEqual(violations(example).count, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +38,7 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
let ruleConfig: ExpiringTodoConfiguration = .init(
|
let ruleConfig: ExpiringTodoConfiguration = .init(
|
||||||
dateDelimiters: .init(opening: "<", closing: ">")
|
dateDelimiters: .init(opening: "<", closing: ">")
|
||||||
)
|
)
|
||||||
config = makeConfiguration(with: ruleConfig)
|
config = Self.makeConfiguration(with: ruleConfig)
|
||||||
|
|
||||||
let example = Example("fatalError() // TODO: <\(dateString(for: .expired))> Implement")
|
let example = Example("fatalError() // TODO: <\(dateString(for: .expired))> Implement")
|
||||||
let violations = self.violations(example)
|
let violations = self.violations(example)
|
||||||
|
@ -58,7 +51,7 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
dateFormat: "MM-dd-yyyy",
|
dateFormat: "MM-dd-yyyy",
|
||||||
dateSeparator: "-"
|
dateSeparator: "-"
|
||||||
)
|
)
|
||||||
config = makeConfiguration(with: ruleConfig)
|
config = Self.makeConfiguration(with: ruleConfig)
|
||||||
|
|
||||||
let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement")
|
let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement")
|
||||||
let violations = self.violations(example)
|
let violations = self.violations(example)
|
||||||
|
@ -70,7 +63,7 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
let ruleConfig: ExpiringTodoConfiguration = .init(
|
let ruleConfig: ExpiringTodoConfiguration = .init(
|
||||||
dateFormat: "yyyy/MM/dd"
|
dateFormat: "yyyy/MM/dd"
|
||||||
)
|
)
|
||||||
config = makeConfiguration(with: ruleConfig)
|
config = Self.makeConfiguration(with: ruleConfig)
|
||||||
|
|
||||||
let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement")
|
let example = Example("fatalError() // TODO: [\(dateString(for: .expired))] Implement")
|
||||||
let violations = self.violations(example)
|
let violations = self.violations(example)
|
||||||
|
@ -139,7 +132,7 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
let ruleConfig: ExpiringTodoConfiguration = .init(
|
let ruleConfig: ExpiringTodoConfiguration = .init(
|
||||||
dateFormat: "dd/yyyy/MM"
|
dateFormat: "dd/yyyy/MM"
|
||||||
)
|
)
|
||||||
config = makeConfiguration(with: ruleConfig)
|
config = Self.makeConfiguration(with: ruleConfig)
|
||||||
|
|
||||||
let example = Example("fatalError() // TODO: [31/01/2020] Implement")
|
let example = Example("fatalError() // TODO: [31/01/2020] Implement")
|
||||||
let violations = self.violations(example)
|
let violations = self.violations(example)
|
||||||
|
@ -151,28 +144,26 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
return SwiftLintFrameworkTests.violations(example, config: config)
|
return SwiftLintFrameworkTests.violations(example, config: config)
|
||||||
}
|
}
|
||||||
|
|
||||||
private func dateString(for status: ExpiringTodoRule.ExpiryViolationLevel?) -> String {
|
private func dateString(for status: ExpiringTodoRule.ExpiryViolationLevel) -> String {
|
||||||
let formatter: DateFormatter = .init()
|
let formatter: DateFormatter = .init()
|
||||||
formatter.dateFormat = config.ruleConfiguration.dateFormat
|
formatter.dateFormat = config.ruleConfiguration.dateFormat
|
||||||
|
|
||||||
return formatter.string(from: date(for: status))
|
return formatter.string(from: date(for: status))
|
||||||
}
|
}
|
||||||
|
|
||||||
private func date(for status: ExpiringTodoRule.ExpiryViolationLevel?) -> Date {
|
private func date(for status: ExpiringTodoRule.ExpiryViolationLevel) -> Date {
|
||||||
let ruleConfiguration = config.ruleConfiguration
|
let ruleConfiguration = config.ruleConfiguration
|
||||||
|
|
||||||
let daysToAdvance: Int
|
let daysToAdvance: Int
|
||||||
|
|
||||||
// swiftlint:disable optional_enum_case_matching
|
|
||||||
switch status {
|
switch status {
|
||||||
case .approachingExpiry?:
|
case .approachingExpiry:
|
||||||
daysToAdvance = ruleConfiguration.approachingExpiryThreshold
|
daysToAdvance = ruleConfiguration.approachingExpiryThreshold
|
||||||
case .expired?:
|
case .expired:
|
||||||
daysToAdvance = 0
|
daysToAdvance = 0
|
||||||
case .badFormatting?, nil:
|
case .badFormatting:
|
||||||
daysToAdvance = ruleConfiguration.approachingExpiryThreshold + 1
|
daysToAdvance = ruleConfiguration.approachingExpiryThreshold + 1
|
||||||
}
|
}
|
||||||
// swiftlint:enable optional_enum_case_matching
|
|
||||||
|
|
||||||
return Calendar.current
|
return Calendar.current
|
||||||
.date(
|
.date(
|
||||||
|
@ -182,7 +173,7 @@ class ExpiringTodoRuleTests: XCTestCase {
|
||||||
)!
|
)!
|
||||||
}
|
}
|
||||||
|
|
||||||
private func makeConfiguration(with ruleConfiguration: ExpiringTodoConfiguration? = nil) -> Configuration {
|
private static func makeConfiguration(with ruleConfiguration: ExpiringTodoConfiguration? = nil) -> Configuration {
|
||||||
var serializedConfig: [String: Any]?
|
var serializedConfig: [String: Any]?
|
||||||
|
|
||||||
if let config = ruleConfiguration {
|
if let config = ruleConfiguration {
|
||||||
|
|
|
@ -12,10 +12,8 @@ class ExtendedNSStringTests: XCTestCase {
|
||||||
"// do something\n" + // 16 characters
|
"// do something\n" + // 16 characters
|
||||||
"}\n" +
|
"}\n" +
|
||||||
"}"
|
"}"
|
||||||
// swiftlint:disable:next legacy_objc_type
|
|
||||||
let string = NSString(string: contents)
|
|
||||||
// A character placed on 80 offset indicates a white-space before 'do' at 5th line.
|
// A character placed on 80 offset indicates a white-space before 'do' at 5th line.
|
||||||
if let lineAndCharacter = StringView(string).lineAndCharacter(forCharacterOffset: 80) {
|
if let lineAndCharacter = StringView(contents).lineAndCharacter(forCharacterOffset: 80) {
|
||||||
XCTAssertEqual(lineAndCharacter.line, 5)
|
XCTAssertEqual(lineAndCharacter.line, 5)
|
||||||
XCTAssertEqual(lineAndCharacter.character, 3)
|
XCTAssertEqual(lineAndCharacter.character, 3)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -214,11 +214,9 @@ class IndentationWidthRuleTests: XCTestCase {
|
||||||
private func countViolations(
|
private func countViolations(
|
||||||
in example: Example,
|
in example: Example,
|
||||||
indentationWidth: Int? = nil,
|
indentationWidth: Int? = nil,
|
||||||
// swiftlint:disable discouraged_optional_boolean
|
includeComments: Bool = true,
|
||||||
includeComments: Bool? = nil,
|
includeCompilerDirectives: Bool = true,
|
||||||
includeCompilerDirectives: Bool? = nil,
|
includeMultilineStrings: Bool = true,
|
||||||
includeMultilineStrings: Bool? = nil,
|
|
||||||
// swiftlint:enable discouraged_optional_boolean
|
|
||||||
file: StaticString = #file,
|
file: StaticString = #file,
|
||||||
line: UInt = #line
|
line: UInt = #line
|
||||||
) -> Int {
|
) -> Int {
|
||||||
|
@ -226,15 +224,9 @@ class IndentationWidthRuleTests: XCTestCase {
|
||||||
if let indentationWidth {
|
if let indentationWidth {
|
||||||
configDict["indentation_width"] = indentationWidth
|
configDict["indentation_width"] = indentationWidth
|
||||||
}
|
}
|
||||||
if let includeComments {
|
configDict["include_comments"] = includeComments
|
||||||
configDict["include_comments"] = includeComments
|
configDict["include_compiler_directives"] = includeCompilerDirectives
|
||||||
}
|
configDict["include_multiline_strings"] = includeMultilineStrings
|
||||||
if let includeCompilerDirectives {
|
|
||||||
configDict["include_compiler_directives"] = includeCompilerDirectives
|
|
||||||
}
|
|
||||||
if let includeMultilineStrings {
|
|
||||||
configDict["include_multiline_strings"] = includeMultilineStrings
|
|
||||||
}
|
|
||||||
|
|
||||||
guard let config = makeConfig(configDict, IndentationWidthRule.description.identifier) else {
|
guard let config = makeConfig(configDict, IndentationWidthRule.description.identifier) else {
|
||||||
XCTFail("Unable to create rule configuration.", file: (file), line: line)
|
XCTFail("Unable to create rule configuration.", file: (file), line: line)
|
||||||
|
@ -248,11 +240,9 @@ class IndentationWidthRuleTests: XCTestCase {
|
||||||
in string: String,
|
in string: String,
|
||||||
equals expectedCount: Int,
|
equals expectedCount: Int,
|
||||||
indentationWidth: Int? = nil,
|
indentationWidth: Int? = nil,
|
||||||
// swiftlint:disable discouraged_optional_boolean
|
includeComments: Bool = true,
|
||||||
includeComments: Bool? = nil,
|
includeCompilerDirectives: Bool = true,
|
||||||
includeCompilerDirectives: Bool? = nil,
|
includeMultilineStrings: Bool = true,
|
||||||
includeMultilineStrings: Bool? = nil,
|
|
||||||
// swiftlint:enable discouraged_optional_boolean
|
|
||||||
file: StaticString = #file,
|
file: StaticString = #file,
|
||||||
line: UInt = #line
|
line: UInt = #line
|
||||||
) {
|
) {
|
||||||
|
@ -275,11 +265,9 @@ class IndentationWidthRuleTests: XCTestCase {
|
||||||
private func assertNoViolation(
|
private func assertNoViolation(
|
||||||
in string: String,
|
in string: String,
|
||||||
indentationWidth: Int? = nil,
|
indentationWidth: Int? = nil,
|
||||||
// swiftlint:disable discouraged_optional_boolean
|
includeComments: Bool = true,
|
||||||
includeComments: Bool? = nil,
|
includeCompilerDirectives: Bool = true,
|
||||||
includeCompilerDirectives: Bool? = nil,
|
includeMultilineStrings: Bool = true,
|
||||||
includeMultilineStrings: Bool? = nil,
|
|
||||||
// swiftlint:enable discouraged_optional_boolean
|
|
||||||
file: StaticString = #file,
|
file: StaticString = #file,
|
||||||
line: UInt = #line
|
line: UInt = #line
|
||||||
) {
|
) {
|
||||||
|
@ -298,11 +286,9 @@ class IndentationWidthRuleTests: XCTestCase {
|
||||||
private func assert1Violation(
|
private func assert1Violation(
|
||||||
in string: String,
|
in string: String,
|
||||||
indentationWidth: Int? = nil,
|
indentationWidth: Int? = nil,
|
||||||
// swiftlint:disable discouraged_optional_boolean
|
includeComments: Bool = true,
|
||||||
includeComments: Bool? = nil,
|
includeCompilerDirectives: Bool = true,
|
||||||
includeCompilerDirectives: Bool? = nil,
|
includeMultilineStrings: Bool = true,
|
||||||
includeMultilineStrings: Bool? = nil,
|
|
||||||
// swiftlint:enable discouraged_optional_boolean
|
|
||||||
file: StaticString = #file,
|
file: StaticString = #file,
|
||||||
line: UInt = #line
|
line: UInt = #line
|
||||||
) {
|
) {
|
||||||
|
|
|
@ -1,26 +1,23 @@
|
||||||
@testable import SwiftLintFramework
|
@testable import SwiftLintFramework
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
// swiftlint:disable:next balanced_xctest_lifecycle
|
|
||||||
class RequiredEnumCaseRuleConfigurationTests: XCTestCase {
|
class RequiredEnumCaseRuleConfigurationTests: XCTestCase {
|
||||||
private typealias RuleConfiguration = RequiredEnumCaseRuleConfiguration
|
private typealias RuleConfiguration = RequiredEnumCaseRuleConfiguration
|
||||||
private typealias RequiredCase = RuleConfiguration.RequiredCase
|
private typealias RequiredCase = RuleConfiguration.RequiredCase
|
||||||
|
|
||||||
private let protocol1 = "RequiredProtocol"
|
private static let protocol1 = "RequiredProtocol"
|
||||||
private let protocol2 = "NetworkResults"
|
private static let protocol2 = "NetworkResults"
|
||||||
private let protocol3 = "RequiredProtocolWithSeverity"
|
private static let protocol3 = "RequiredProtocolWithSeverity"
|
||||||
private let rule1 = RuleConfiguration.RequiredCase(name: "success", severity: .warning)
|
private static let rule1 = RuleConfiguration.RequiredCase(name: "success", severity: .warning)
|
||||||
private let rule2 = RuleConfiguration.RequiredCase(name: "error", severity: .warning)
|
private static let rule2 = RuleConfiguration.RequiredCase(name: "error", severity: .warning)
|
||||||
private let rule3 = RuleConfiguration.RequiredCase(name: "success", severity: .error)
|
private static let rule3 = RuleConfiguration.RequiredCase(name: "success", severity: .error)
|
||||||
|
|
||||||
private var config: RuleConfiguration!
|
private var config: RuleConfiguration = {
|
||||||
|
var config = RuleConfiguration()
|
||||||
override func setUp() {
|
|
||||||
super.setUp()
|
|
||||||
config = RuleConfiguration()
|
|
||||||
config.protocols[protocol1] = [rule1, rule2]
|
config.protocols[protocol1] = [rule1, rule2]
|
||||||
config.protocols[protocol2] = [rule2]
|
config.protocols[protocol2] = [rule2]
|
||||||
}
|
return config
|
||||||
|
}()
|
||||||
|
|
||||||
func testRequiredCaseHashValue() {
|
func testRequiredCaseHashValue() {
|
||||||
let requiredCase = RequiredCase(name: "success")
|
let requiredCase = RequiredCase(name: "success")
|
||||||
|
@ -68,22 +65,22 @@ class RequiredEnumCaseRuleConfigurationTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func validateRulesExistForProtocol1() {
|
private func validateRulesExistForProtocol1() {
|
||||||
XCTAssertTrue(self.config.protocols[protocol1]?.contains(self.rule1) ?? false)
|
XCTAssertTrue(self.config.protocols[Self.protocol1]?.contains(Self.rule1) ?? false)
|
||||||
XCTAssertTrue(self.config.protocols[protocol1]?.contains(self.rule2) ?? false)
|
XCTAssertTrue(self.config.protocols[Self.protocol1]?.contains(Self.rule2) ?? false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRegisterProtocolCasesRegistersCasesWithSpecifiedSeverity() {
|
func testRegisterProtocolCasesRegistersCasesWithSpecifiedSeverity() {
|
||||||
config.register(protocol: protocol3, cases: ["success": "error", "error": "warning"])
|
config.register(protocol: Self.protocol3, cases: ["success": "error", "error": "warning"])
|
||||||
validateRulesExistForProtocol3()
|
validateRulesExistForProtocol3()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func validateRulesExistForProtocol3() {
|
private func validateRulesExistForProtocol3() {
|
||||||
XCTAssertTrue(self.config.protocols[protocol3]?.contains(self.rule3) ?? false)
|
XCTAssertTrue(self.config.protocols[Self.protocol3]?.contains(Self.rule3) ?? false)
|
||||||
XCTAssertTrue(self.config.protocols[protocol3]?.contains(self.rule2) ?? false)
|
XCTAssertTrue(self.config.protocols[Self.protocol3]?.contains(Self.rule2) ?? false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testRegisterProtocols() {
|
func testRegisterProtocols() {
|
||||||
config.register(protocols: [protocol1: ["success": "warning", "error": "warning"]])
|
config.register(protocols: [Self.protocol1: ["success": "warning", "error": "warning"]])
|
||||||
validateRulesExistForProtocol1()
|
validateRulesExistForProtocol1()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,36 +97,36 @@ class RequiredEnumCaseRuleConfigurationTests: XCTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
func testApplyRegistersProtocols() {
|
func testApplyRegistersProtocols() {
|
||||||
try? config.apply(configuration: [protocol1: ["success": "warning", "error": "warning"]])
|
try? config.apply(configuration: [Self.protocol1: ["success": "warning", "error": "warning"]])
|
||||||
validateRulesExistForProtocol1()
|
validateRulesExistForProtocol1()
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEqualsReturnsTrue() {
|
func testEqualsReturnsTrue() {
|
||||||
var lhs = RuleConfiguration()
|
var lhs = RuleConfiguration()
|
||||||
try? lhs.apply(configuration: [protocol1: ["success", "error"]])
|
try? lhs.apply(configuration: [Self.protocol1: ["success", "error"]])
|
||||||
|
|
||||||
var rhs = RuleConfiguration()
|
var rhs = RuleConfiguration()
|
||||||
try? rhs.apply(configuration: [protocol1: ["success", "error"]])
|
try? rhs.apply(configuration: [Self.protocol1: ["success", "error"]])
|
||||||
|
|
||||||
XCTAssertEqual(lhs, rhs)
|
XCTAssertEqual(lhs, rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEqualsReturnsFalseBecauseProtocolsArentEqual() {
|
func testEqualsReturnsFalseBecauseProtocolsArentEqual() {
|
||||||
var lhs = RuleConfiguration()
|
var lhs = RuleConfiguration()
|
||||||
try? lhs.apply(configuration: [protocol1: ["success": "error"]])
|
try? lhs.apply(configuration: [Self.protocol1: ["success": "error"]])
|
||||||
|
|
||||||
var rhs = RuleConfiguration()
|
var rhs = RuleConfiguration()
|
||||||
try? rhs.apply(configuration: [protocol2: ["success": "error", "error": "warning"]])
|
try? rhs.apply(configuration: [Self.protocol2: ["success": "error", "error": "warning"]])
|
||||||
|
|
||||||
XCTAssertNotEqual(lhs, rhs)
|
XCTAssertNotEqual(lhs, rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testEqualsReturnsFalseBecauseSeverityIsntEqual() {
|
func testEqualsReturnsFalseBecauseSeverityIsntEqual() {
|
||||||
var lhs = RuleConfiguration()
|
var lhs = RuleConfiguration()
|
||||||
try? lhs.apply(configuration: [protocol1: ["success": "error", "error": "error"]])
|
try? lhs.apply(configuration: [Self.protocol1: ["success": "error", "error": "error"]])
|
||||||
|
|
||||||
var rhs = RuleConfiguration()
|
var rhs = RuleConfiguration()
|
||||||
try? rhs.apply(configuration: [protocol1: ["success": "warning", "error": "error"]])
|
try? rhs.apply(configuration: [Self.protocol1: ["success": "warning", "error": "error"]])
|
||||||
|
|
||||||
XCTAssertNotEqual(lhs, rhs)
|
XCTAssertNotEqual(lhs, rhs)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
@testable import SwiftLintFramework
|
@testable import SwiftLintFramework
|
||||||
import XCTest
|
import XCTest
|
||||||
|
|
||||||
// swiftlint:disable:next balanced_xctest_lifecycle
|
|
||||||
class SwiftLintFileTests: XCTestCase {
|
class SwiftLintFileTests: XCTestCase {
|
||||||
private let tempFile = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
|
private let tempFile = FileManager.default.temporaryDirectory.appendingPathComponent(UUID().uuidString)
|
||||||
|
|
||||||
|
@ -10,6 +9,11 @@ class SwiftLintFileTests: XCTestCase {
|
||||||
try "let i = 2".data(using: .utf8)!.write(to: tempFile)
|
try "let i = 2".data(using: .utf8)!.write(to: tempFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override func tearDown() async throws {
|
||||||
|
try FileManager.default.removeItem(at: tempFile)
|
||||||
|
try await super.tearDown()
|
||||||
|
}
|
||||||
|
|
||||||
func testFileFromStringUpdate() {
|
func testFileFromStringUpdate() {
|
||||||
let file = SwiftLintFile(contents: "let i = 1")
|
let file = SwiftLintFile(contents: "let i = 1")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue