working on swiftlint warnings

This commit is contained in:
Mike Kinney 2021-11-29 16:51:59 -08:00
parent f079ffe119
commit feeb7be7e1
4 changed files with 81 additions and 69 deletions

View file

@ -1,10 +1,10 @@
line_length: 200
line_length: 400
type_name:
min_length: 1 # only warning
max_length: # warning and error
warning: 40
error: 50
warning: 60
error: 70
excluded: iPhone # excluded via string
allowed_symbols: ["_"] # these are allowed in type names
identifier_name:
@ -17,8 +17,8 @@ force_try:
# TODO: should review
file_length:
warning: 2000
error: 2500
warning: 2500
error: 3000
# TODO: should review
cyclomatic_complexity:
@ -30,5 +30,17 @@ cyclomatic_complexity:
function_body_length:
warning: 200
# TODO: should review
type_body_length:
warning: 400
# TODO: should review
disabled_rules: # rule identifiers to exclude from running
- operator_whitespace
- multiple_closures_with_trailing_closure
- todo
# TODO: should review
nesting:
type_level:
warning: 3

View file

@ -315,34 +315,34 @@ class BLEManager: NSObject, ObservableObject, CBCentralManagerDelegate, CBPeriph
for characteristic in characteristics {
switch characteristic.uuid {
case TORADIO_UUID:
print("TORADIO characteristic OK")
switch characteristic.uuid {
case TORADIO_UUID:
print("TORADIO characteristic OK")
if meshLoggingEnabled { MeshLogger.log("BLE did discover TORADIO characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") }
TORADIO_characteristic = characteristic
var toRadio: ToRadio = ToRadio()
toRadio.wantConfigID = 32168
let binaryData: Data = try! toRadio.serializedData()
peripheral.writeValue(binaryData, for: characteristic, type: .withResponse)
break
TORADIO_characteristic = characteristic
var toRadio: ToRadio = ToRadio()
toRadio.wantConfigID = 32168
let binaryData: Data = try! toRadio.serializedData()
peripheral.writeValue(binaryData, for: characteristic, type: .withResponse)
break
case FROMRADIO_UUID:
print("FROMRADIO characteristic OK")
case FROMRADIO_UUID:
print("FROMRADIO characteristic OK")
if meshLoggingEnabled { MeshLogger.log("BLE did discover FROMRADIO characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") }
FROMRADIO_characteristic = characteristic
peripheral.readValue(for: FROMRADIO_characteristic)
break
FROMRADIO_characteristic = characteristic
peripheral.readValue(for: FROMRADIO_characteristic)
break
case FROMNUM_UUID:
print("FROMNUM (Notify) characteristic OK")
case FROMNUM_UUID:
print("FROMNUM (Notify) characteristic OK")
if meshLoggingEnabled { MeshLogger.log("BLE did discover FROMNUM (Notify) characteristic for Meshtastic by \(peripheral.name ?? "Unknown")") }
FROMNUM_characteristic = characteristic
peripheral.setNotifyValue(true, for: characteristic)
break
FROMNUM_characteristic = characteristic
peripheral.setNotifyValue(true, for: characteristic)
break
default:
break
}
default:
break
}
}
}

View file

@ -42,36 +42,36 @@ typealias NodeColor = Int
extension NodeColor {
// a color to represent an individual meshtastic device
var color: Color {
switch self {
case 0:
return Color(.red)
case 1:
return Color(.blue)
case 2:
return Color(.yellow)
case 3:
return Color(.green)
case 4:
return Color(.purple)
case 5:
return Color(.systemPink)
case 6:
return Color(.systemTeal)
case 7:
return Color(.black)
case 8:
return Color(.gray)
case 9:
return Color(.brown)
case 10:
return Color(.magenta)
case 11:
return Color(.orange)
case 12:
return Color(.cyan)
default:
return Color(.blue)
}
}
var color: Color {
switch self {
case 0:
return Color(.red)
case 1:
return Color(.blue)
case 2:
return Color(.yellow)
case 3:
return Color(.green)
case 4:
return Color(.purple)
case 5:
return Color(.systemPink)
case 6:
return Color(.systemTeal)
case 7:
return Color(.black)
case 8:
return Color(.gray)
case 9:
return Color(.brown)
case 10:
return Color(.magenta)
case 11:
return Color(.orange)
case 12:
return Color(.cyan)
default:
return Color(.blue)
}
}
}

View file

@ -15,16 +15,16 @@ enum KeyboardType: Int, CaseIterable, Identifiable {
var description: String {
get {
switch self {
case .defaultKeyboard:
return "Default"
case .asciiCapable:
return "ASCII Capable"
case .twitter:
return "Twitter"
case .emailAddress:
return "Email Address"
case .numbersAndPunctuation:
return "Numbers and Punctuation"
case .defaultKeyboard:
return "Default"
case .asciiCapable:
return "ASCII Capable"
case .twitter:
return "Twitter"
case .emailAddress:
return "Email Address"
case .numbersAndPunctuation:
return "Numbers and Punctuation"
}
}
}