Enabled more swiftlint rules
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
This commit is contained in:
parent
5618c465a2
commit
a89ad95901
|
@ -3,7 +3,17 @@ disabled_rules:
|
|||
- trailing_whitespace
|
||||
- todo
|
||||
opt_in_rules:
|
||||
- empty_count
|
||||
- empty_string
|
||||
- implicitly_unwrapped_optional
|
||||
- legacy_random
|
||||
- let_var_whitespace
|
||||
- literal_expression_end_indentation
|
||||
- override_in_extension
|
||||
- redundant_type_annotation
|
||||
- toggle_bool
|
||||
- unneeded_parentheses_in_closure_argument
|
||||
- unused_import
|
||||
# - trailing_closure
|
||||
file_length:
|
||||
warning: 500
|
||||
|
|
|
@ -8,6 +8,7 @@ public class Logger {
|
|||
enum LoggerError: Error {
|
||||
case openFailure
|
||||
}
|
||||
|
||||
static var global: Logger?
|
||||
|
||||
var log: OpaquePointer
|
||||
|
|
|
@ -42,7 +42,7 @@ class WgQuickConfigFileParser {
|
|||
|
||||
trimmedLine = trimmedLine.trimmingCharacters(in: .whitespaces)
|
||||
|
||||
guard trimmedLine.count > 0 else { continue }
|
||||
guard !trimmedLine.isEmpty else { continue }
|
||||
let lowercasedLine = line.lowercased()
|
||||
|
||||
if let equalsIndex = line.firstIndex(of: "=") {
|
||||
|
|
|
@ -52,6 +52,7 @@ enum TunnelsManagerActivationAttemptError: WireGuardAppError {
|
|||
enum TunnelsManagerActivationError: WireGuardAppError {
|
||||
case activationFailed
|
||||
case activationFailedWithExtensionError(title: String, message: String)
|
||||
|
||||
var alertText: AlertText {
|
||||
switch self {
|
||||
case .activationFailed:
|
||||
|
|
|
@ -361,7 +361,7 @@ class TunnelViewModel {
|
|||
var peersData: [PeerData]
|
||||
|
||||
init(tunnelConfiguration: TunnelConfiguration?) {
|
||||
let interfaceData: InterfaceData = InterfaceData()
|
||||
let interfaceData = InterfaceData()
|
||||
var peersData = [PeerData]()
|
||||
if let tunnelConfiguration = tunnelConfiguration {
|
||||
interfaceData.validatedConfiguration = tunnelConfiguration.interface
|
||||
|
|
|
@ -76,15 +76,11 @@ class QRScanViewController: UIViewController {
|
|||
super.viewDidLayoutSubviews()
|
||||
|
||||
if let connection = previewLayer?.connection {
|
||||
|
||||
let currentDevice: UIDevice = UIDevice.current
|
||||
|
||||
let orientation: UIDeviceOrientation = currentDevice.orientation
|
||||
|
||||
let previewLayerConnection: AVCaptureConnection = connection
|
||||
let currentDevice = UIDevice.current
|
||||
let orientation = currentDevice.orientation
|
||||
let previewLayerConnection = connection
|
||||
|
||||
if previewLayerConnection.isVideoOrientationSupported {
|
||||
|
||||
switch orientation {
|
||||
case .portrait:
|
||||
previewLayerConnection.videoOrientation = .portrait
|
||||
|
|
|
@ -127,7 +127,7 @@ class TunnelsListTableViewController: UIViewController {
|
|||
present(alert, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc func settingsButtonTapped(sender: UIBarButtonItem!) {
|
||||
@objc func settingsButtonTapped(sender: UIBarButtonItem) {
|
||||
guard tunnelsManager != nil else { return }
|
||||
|
||||
let settingsVC = SettingsTableViewController(tunnelsManager: tunnelsManager)
|
||||
|
|
|
@ -3,5 +3,6 @@
|
|||
|
||||
protocol WireGuardAppError: Error {
|
||||
typealias AlertText = (title: String, message: String)
|
||||
|
||||
var alertText: AlertText { get }
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ class DNSResolver {
|
|||
}
|
||||
|
||||
static func resolveSync(endpoints: [Endpoint?]) throws -> [Endpoint?] {
|
||||
let dispatchGroup: DispatchGroup = DispatchGroup()
|
||||
let dispatchGroup = DispatchGroup()
|
||||
|
||||
if isAllEndpointsAlreadyResolved(endpoints: endpoints) {
|
||||
return endpoints
|
||||
|
|
|
@ -36,7 +36,7 @@ class PacketTunnelSettingsGenerator {
|
|||
if let listenPort = tunnelConfiguration.interface.listenPort {
|
||||
wgSettings.append("listen_port=\(listenPort)\n")
|
||||
}
|
||||
if tunnelConfiguration.peers.count > 0 {
|
||||
if !tunnelConfiguration.peers.isEmpty {
|
||||
wgSettings.append("replace_peers=true\n")
|
||||
}
|
||||
assert(tunnelConfiguration.peers.count == resolvedEndpoints.count)
|
||||
|
|
Loading…
Reference in New Issue