From 6937ec38b0c383b0505caeea6603e62086bf5431 Mon Sep 17 00:00:00 2001 From: "eric.marchand" Date: Sun, 14 Feb 2021 09:34:20 +0100 Subject: [PATCH] Fix SwiftLint warnings --- .swiftlint.yml | 1 + Sources/DispatchWatcher.swift | 8 ++++---- Sources/FileSystemWatcher.swift | 12 ++++++------ Sources/Path.swift | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index b09e5df..fa9b18a 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -6,6 +6,7 @@ disabled_rules: - cyclomatic_complexity - variable_name - type_name + - todo shorthand_operator: warning superfluous_disable_command: warning diff --git a/Sources/DispatchWatcher.swift b/Sources/DispatchWatcher.swift index 9169f25..985ee06 100644 --- a/Sources/DispatchWatcher.swift +++ b/Sources/DispatchWatcher.swift @@ -145,7 +145,7 @@ open class DispatchFileSystemWatcher { // MARK: - Deinitialization deinit { - //print("\(path): Deinit") + // print("\(path): Deinit") close() } @@ -217,7 +217,7 @@ open class DispatchFileSystemWatcher { // stop watching when path created if self?.path.isRegular == true || self?.path.isDirectoryFile == true { self?.dispatchDelegate(.Create) - //self.delegate?.fsWatcherDidObserveCreate(self) + // self.delegate?.fsWatcherDidObserveCreate(self) self?.createWatcher = nil self?.startWatching() watch.stopWatching() @@ -245,13 +245,13 @@ open class DispatchFileSystemWatcher { } // Define the block to call when a file change is detected. - source!.setEventHandler { //[unowned self] () in + source!.setEventHandler { // [unowned self] () in let eventType = DispatchFileSystemEvents(rawValue: self.source!.data) self.dispatchDelegate(eventType) } // Define a cancel handler to ensure the path is closed when the source is cancelled. - source!.setCancelHandler { //[unowned self] () in + source!.setCancelHandler { // [unowned self] () in _ = Darwin.close(self.fileDescriptor) self.fileDescriptor = -1 self.source = nil diff --git a/Sources/FileSystemWatcher.swift b/Sources/FileSystemWatcher.swift index a07b125..5ca5005 100644 --- a/Sources/FileSystemWatcher.swift +++ b/Sources/FileSystemWatcher.swift @@ -35,13 +35,13 @@ public class FileSystemWatcher { // MARK: - Private Static Properties /// The event stream callback for when events occur. - private static let _eventCallback: FSEventStreamCallback = { + private static let _eventCallback: FSEventStreamCallback = { // swiftlint:disable all (stream: ConstFSEventStreamRef, - contextInfo: UnsafeMutableRawPointer?, - numEvents: Int, - eventPaths: UnsafeMutableRawPointer, - eventFlags: UnsafePointer, - eventIds: UnsafePointer) in + contextInfo: UnsafeMutableRawPointer?, + numEvents: Int, + eventPaths: UnsafeMutableRawPointer, + eventFlags: UnsafePointer, + eventIds: UnsafePointer) in // swiftlint:enable all FileSystemWatcher.log("Callback Fired") diff --git a/Sources/Path.swift b/Sources/Path.swift index 9f1bf8f..9bfa44e 100644 --- a/Sources/Path.swift +++ b/Sources/Path.swift @@ -70,9 +70,9 @@ public struct Path { weak var delegate: FileManagerDelegate? /// Safe way to use fileManager var fileManager: FileManager { - //if delegate == nil { + // if delegate == nil { // print("\n\nDelegate is nil\n\n") - //} + // } unsafeFileManager.delegate = delegate return unsafeFileManager }