Skip to content

Commit

Permalink
fix: fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
nickybondarenko committed Apr 12, 2024
1 parent ff96d25 commit c94bf0c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 23 deletions.
10 changes: 0 additions & 10 deletions ConfidenceDemoApp/ConfidenceDemoAppTests/ConfidenceDemoTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@ import XCTest
@testable import ConfidenceDemoApp

final class ConfidenceDemoTests: XCTestCase {
override func setUpWithError() throws {
try super.setUpWithError()
// Put setup code here. This method is called before the invocation of each test method in the class.
}

override func tearDownWithError() throws {
try super.tearDownWithError()
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testExample() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct results.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ final class ConfidenceDemoUITests: XCTestCase {
// In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this.
}

override func tearDownWithError() throws {
try super.tearDownWithError()
// Put teardown code here. This method is called after the invocation of each test method in the class.
}

func testExample() throws {
// UI tests must launch the application that they test.
let app = XCUIApplication()
Expand Down
14 changes: 7 additions & 7 deletions Sources/Confidence/EventStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ internal class EventStorageImpl: EventStorage {
private let READYTOSENDEXTENSION = "READY"
private let storageQueue = DispatchQueue(label: "com.confidence.events.storage")
private var folderURL: URL
private var currentFileUrl: URL? = nil
private var currentFileHandle: FileHandle? = nil
private var currentFileUrl: URL?
private var currentFileHandle: FileHandle?

init() throws {
self.folderURL = try EventStorageImpl.getFolderURL()
if(!FileManager.default.fileExists(atPath: folderURL.backport.path)) {
if !FileManager.default.fileExists(atPath: folderURL.backport.path) {
try FileManager.default.createDirectory(at: folderURL, withIntermediateDirectories: true)
}
try resetCurrentFile()
Expand All @@ -34,7 +34,7 @@ internal class EventStorageImpl: EventStorage {
try resetCurrentFile()
}
}

func writeEvent(event: Event) throws {
try storageQueue.sync {
guard let currentFileHandle = currentFileHandle else {
Expand All @@ -56,10 +56,10 @@ internal class EventStorageImpl: EventStorage {
func batchReadyIds() throws -> [String] {
try storageQueue.sync {
let fileUrls = try FileManager.default.contentsOfDirectory(at: folderURL, includingPropertiesForKeys: nil)
return fileUrls.filter({ url in url.pathExtension == READYTOSENDEXTENSION }).map({ url in url.lastPathComponent })
return fileUrls.filter({ url in url.pathExtension == READYTOSENDEXTENSION }).map({ url in url.lastPathComponent })

Check warning on line 59 in Sources/Confidence/EventStorage.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Line Length Violation: Line should be 120 characters or less; currently it has 126 characters (line_length)

Check warning on line 59 in Sources/Confidence/EventStorage.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Closure Violation: Trailing closure syntax should be used whenever possible (trailing_closure)

Check warning on line 59 in Sources/Confidence/EventStorage.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Closure Violation: Trailing closure syntax should be used whenever possible (trailing_closure)
}
}

func eventsFrom(id: String) throws -> [Event] {
try storageQueue.sync {
let decoder = JSONDecoder()
Expand All @@ -68,7 +68,7 @@ internal class EventStorageImpl: EventStorage {
let dataString = String(data: data, encoding: .utf8)
return try dataString?.components(separatedBy: "\n")

Check warning on line 69 in Sources/Confidence/EventStorage.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Closure Violation: Trailing closure syntax should be used whenever possible (trailing_closure)

Check warning on line 69 in Sources/Confidence/EventStorage.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Trailing Closure Violation: Trailing closure syntax should be used whenever possible (trailing_closure)
.filter({ events in !events.isEmpty })
.map({ eventString in try decoder.decode(Event.self, from: eventString.data(using: .utf8)!)}) ?? []
.map({ eventString in try decoder.decode(Event.self, from: eventString.data(using: .utf8)!) }) ?? []

Check warning on line 71 in Sources/Confidence/EventStorage.swift

View workflow job for this annotation

GitHub Actions / SwiftLint

Force Unwrapping Violation: Force unwrapping should be avoided (force_unwrapping)
}
}

Expand Down
1 change: 0 additions & 1 deletion Tests/ConfidenceTests/EventStorageTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import XCTest
@testable import Confidence

class EventStorageTest: XCTestCase {

override func setUp() async throws {
let folderURL = try! EventStorageImpl.getFolderURL()
if FileManager.default.fileExists(atPath: folderURL.path) {
Expand Down

0 comments on commit c94bf0c

Please sign in to comment.