Enable SwiftLint rule 'multiline_function_chains' and fix all violations
This commit is contained in:
parent
c87f4e9792
commit
776c813f94
3 changed files with 27 additions and 26 deletions
|
|
@ -98,7 +98,7 @@ whitelist_rules:
|
||||||
- modifier_order
|
- modifier_order
|
||||||
- multiline_arguments
|
- multiline_arguments
|
||||||
- multiline_arguments_brackets
|
- multiline_arguments_brackets
|
||||||
# - multiline_function_chains
|
- multiline_function_chains
|
||||||
# - multiline_literal_brackets
|
# - multiline_literal_brackets
|
||||||
# - multiline_parameters
|
# - multiline_parameters
|
||||||
# - multiline_parameters_brackets
|
# - multiline_parameters_brackets
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,8 @@ class UICodeHighlightingLabel: UILocalizedLabel {
|
||||||
return NSAttributedString(string: line, attributes: UICodeHighlightingLabel.CODE_ATTRIBUTES)
|
return NSAttributedString(string: line, attributes: UICodeHighlightingLabel.CODE_ATTRIBUTES)
|
||||||
}
|
}
|
||||||
return NSAttributedString(string: line)
|
return NSAttributedString(string: line)
|
||||||
}.reduce(into: NSMutableAttributedString(string: "")) {
|
}
|
||||||
|
.reduce(into: NSMutableAttributedString(string: "")) {
|
||||||
$0.append($1)
|
$0.append($1)
|
||||||
$0.append(UICodeHighlightingLabel.ATTRIBUTED_NEWLINE)
|
$0.append(UICodeHighlightingLabel.ATTRIBUTED_NEWLINE)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -262,19 +262,19 @@ public class PasswordStore {
|
||||||
private func updatePasswordEntityCoreData() {
|
private func updatePasswordEntityCoreData() {
|
||||||
deleteCoreData(entityName: "PasswordEntity")
|
deleteCoreData(entityName: "PasswordEntity")
|
||||||
do {
|
do {
|
||||||
var q = try fm.contentsOfDirectory(atPath: storeURL.path).filter {
|
var q = try fm.contentsOfDirectory(atPath: storeURL.path)
|
||||||
!$0.hasPrefix(".")
|
.filter { !$0.hasPrefix(".") }
|
||||||
}.map { (filename) -> PasswordEntity in
|
.map { (filename) -> PasswordEntity in
|
||||||
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||||
if filename.hasSuffix(".gpg") {
|
if filename.hasSuffix(".gpg") {
|
||||||
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
||||||
} else {
|
} else {
|
||||||
passwordEntity.name = filename
|
passwordEntity.name = filename
|
||||||
|
}
|
||||||
|
passwordEntity.path = filename
|
||||||
|
passwordEntity.parent = nil
|
||||||
|
return passwordEntity
|
||||||
}
|
}
|
||||||
passwordEntity.path = filename
|
|
||||||
passwordEntity.parent = nil
|
|
||||||
return passwordEntity
|
|
||||||
}
|
|
||||||
while !q.isEmpty {
|
while !q.isEmpty {
|
||||||
let e = q.first!
|
let e = q.first!
|
||||||
q.remove(at: 0)
|
q.remove(at: 0)
|
||||||
|
|
@ -286,19 +286,19 @@ public class PasswordStore {
|
||||||
if fm.fileExists(atPath: filePath, isDirectory: &isDirectory) {
|
if fm.fileExists(atPath: filePath, isDirectory: &isDirectory) {
|
||||||
if isDirectory.boolValue {
|
if isDirectory.boolValue {
|
||||||
e.isDir = true
|
e.isDir = true
|
||||||
let files = try fm.contentsOfDirectory(atPath: filePath).filter {
|
let files = try fm.contentsOfDirectory(atPath: filePath)
|
||||||
!$0.hasPrefix(".")
|
.filter { !$0.hasPrefix(".") }
|
||||||
}.map { (filename) -> PasswordEntity in
|
.map { (filename) -> PasswordEntity in
|
||||||
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
let passwordEntity = NSEntityDescription.insertNewObject(forEntityName: "PasswordEntity", into: context) as! PasswordEntity
|
||||||
if filename.hasSuffix(".gpg") {
|
if filename.hasSuffix(".gpg") {
|
||||||
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
passwordEntity.name = String(filename.prefix(upTo: filename.index(filename.endIndex, offsetBy: -4)))
|
||||||
} else {
|
} else {
|
||||||
passwordEntity.name = filename
|
passwordEntity.name = filename
|
||||||
|
}
|
||||||
|
passwordEntity.path = "\(e.path!)/\(filename)"
|
||||||
|
passwordEntity.parent = e
|
||||||
|
return passwordEntity
|
||||||
}
|
}
|
||||||
passwordEntity.path = "\(e.path!)/\(filename)"
|
|
||||||
passwordEntity.parent = e
|
|
||||||
return passwordEntity
|
|
||||||
}
|
|
||||||
q += files
|
q += files
|
||||||
} else {
|
} else {
|
||||||
e.isDir = false
|
e.isDir = false
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue