Enable some more SwitfLint rules (#565)

This commit is contained in:
Danny Mösch 2022-06-16 04:55:02 +02:00 committed by GitHub
parent 4da22b0a80
commit ad105b3df1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 5 deletions

View file

@ -11,6 +11,7 @@ excluded:
## Active rules ## Active rules
only_rules: only_rules:
- accessibility_label_for_image
# - anonymous_argument_in_multiline_closure # - anonymous_argument_in_multiline_closure
- anyobject_protocol - anyobject_protocol
- array_init - array_init
@ -27,6 +28,7 @@ only_rules:
- collection_alignment - collection_alignment
- colon - colon
- comma - comma
- comma_inheritance
- comment_spacing - comment_spacing
- compiler_protocol_init - compiler_protocol_init
- computed_accessors_order - computed_accessors_order
@ -141,6 +143,7 @@ only_rules:
- override_in_extension - override_in_extension
- pattern_matching_keywords - pattern_matching_keywords
# - prefer_nimble # - prefer_nimble
- prefer_self_in_static_references
- prefer_self_type_over_type_of_self - prefer_self_type_over_type_of_self
- prefer_zero_over_explicit_init - prefer_zero_over_explicit_init
# - prefixed_toplevel_constant # Violations are mostly in test code. # - prefixed_toplevel_constant # Violations are mostly in test code.
@ -169,6 +172,7 @@ only_rules:
# - required_deinit # - required_deinit
- required_enum_case - required_enum_case
- return_arrow_whitespace - return_arrow_whitespace
- return_value_from_void_function
- self_in_property_initialization - self_in_property_initialization
- shorthand_operator - shorthand_operator
- single_test_class - single_test_class
@ -193,6 +197,7 @@ only_rules:
# - type_body_length # - type_body_length
# - type_contents_order # - type_contents_order
- type_name - type_name
- unavailable_condition
- unavailable_function - unavailable_function
- unneeded_break_in_switch - unneeded_break_in_switch
- unneeded_parentheses_in_closure_argument - unneeded_parentheses_in_closure_argument

View file

@ -386,9 +386,10 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni
func openLink(to address: String?) { func openLink(to address: String?) {
guard address != nil, let url = URL(string: formActualWebAddress(from: address!)) else { guard address != nil, let url = URL(string: formActualWebAddress(from: address!)) else {
return DispatchQueue.main.async { DispatchQueue.main.async {
Utils.alert(title: "Error".localize(), message: "CannotFindValidUrl".localize(), controller: self, completion: nil) Utils.alert(title: "Error".localize(), message: "CannotFindValidUrl".localize(), controller: self, completion: nil)
} }
return
} }
SecurePasteboard.shared.copy(textToCopy: password?.password) SecurePasteboard.shared.copy(textToCopy: password?.password)
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)

View file

@ -90,13 +90,16 @@ class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDeleg
func metadataOutput(_: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from _: AVCaptureConnection) { func metadataOutput(_: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from _: AVCaptureConnection) {
guard let metadataObj = metadataObjects.first as? AVMetadataMachineReadableCodeObject else { guard let metadataObj = metadataObjects.first as? AVMetadataMachineReadableCodeObject else {
return setNotDetected() setNotDetected()
return
} }
guard supportedCodeTypes.contains(metadataObj.type) else { guard supportedCodeTypes.contains(metadataObj.type) else {
return setNotDetected() setNotDetected()
return
} }
guard let barCodeObject = videoPreviewLayer?.transformedMetadataObject(for: metadataObj) else { guard let barCodeObject = videoPreviewLayer?.transformedMetadataObject(for: metadataObj) else {
return setNotDetected() setNotDetected()
return
} }
// draw a bounds on the found QR code // draw a bounds on the found QR code

View file

@ -36,7 +36,8 @@ class SSHKeyURLImportTableViewController: AutoCellHeightUITableViewController {
self.performSegue(withIdentifier: "importSSHKeySegue", sender: self) self.performSegue(withIdentifier: "importSSHKeySegue", sender: self)
} }
) )
return present(savePassphraseAlert, animated: true) present(savePassphraseAlert, animated: true)
return
} }
sshPrivateKeyURL = privateKeyURL sshPrivateKeyURL = privateKeyURL
performSegue(withIdentifier: "importSSHKeySegue", sender: self) performSegue(withIdentifier: "importSSHKeySegue", sender: self)