Showing 94 of 254 total issues
Function loadImageTV
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func loadImageTV(forCell cell: EventTableViewCell, forItemAt indexPath: IndexPath) {
guard let event = filteredEvents?[indexPath.item] else { return }
if let cachedImage = cache.value(for: event.id) {
cell.eventImageView?.image = cachedImage
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getUser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func getUser(completion: @escaping (Swift.Result<[String], Error>) -> Void) {
self.stateManager?.getUser({ [weak self] response, error in
if let error = error {
print("Error retrieving user info: \(error)")
completion(.failure(error))
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setUpWithFilters
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private func setUpWithFilters() {
if let dateRange = filter.dateRange {
dateTextField.text = "\(filterDateFormatter.string(from: dateRange.min)) - \(filterDateFormatter.string(from: dateRange.max))"
firstDatePickerView.date = dateRange.min
secondDatePickerView.date = dateRange.max
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function checkAuthStatus
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func checkAuthStatus(completion: @escaping () -> Void) {
guard let stateManager = authController.stateManager, let accessToken = authController.stateManager?.accessToken else {
print("No state manager or access token. State Manager at load of Tab Bar Controller")
completion()
return
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function anchor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
func anchor(top: NSLayoutYAxisAnchor?, leading: NSLayoutXAxisAnchor?, trailing: NSLayoutXAxisAnchor?, bottom: NSLayoutYAxisAnchor?, centerX: NSLayoutXAxisAnchor?, centerY: NSLayoutYAxisAnchor?, padding: UIEdgeInsets = .zero, size: CGSize = .zero) {
translatesAutoresizingMaskIntoConstraints = false
if let top = top {
topAnchor.constraint(equalTo: top, constant: padding.top).isActive = true
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function constraint
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@discardableResult func constraint(firstView: UIView, to secondView: UIView, top: NSLayoutConstraint? = nil, bot: NSLayoutConstraint? = nil, left: NSLayoutConstraint? = nil, right: NSLayoutConstraint? = nil) -> [NSLayoutConstraint] {
let topConst: NSLayoutConstraint
let botConst: NSLayoutConstraint
let leftConst: NSLayoutConstraint
let rightConst: NSLayoutConstraint
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function keyboardWillShow
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@objc func keyboardWillShow(notification: Notification) {
keyboardDismissTapGestureRecognizer.isEnabled = true
var keyboardSize: CGRect = .zero
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function urlSession
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public func urlSession(_ session: URLSession, task: URLSessionTask, willPerformHTTPRedirection response: HTTPURLResponse, newRequest request: URLRequest, completionHandler: @escaping (URLRequest?) -> Void) {
Function signOut
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public func signOut(with options: OktaSignOutOptions,
authStateManager: OktaOidcStateManager,
from presenter: UIViewController,
progressHandler: @escaping ((OktaSignOutOptions) -> Void),
completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
Function updateProfilePic
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func updateProfilePic(image: String, graphQLID: String, accessToken: String, file: GraphQLFile, completion: @escaping (Swift.Result<AddProfilePicMutation.Data.UpdateUser, Error>) -> Void) {
Function calendar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func calendar(_ calendar: JTACMonthView, willDisplay cell: JTACDayCell, forItemAt date: Date, cellState: CellState, indexPath: IndexPath) {
Function calendar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func calendar(_ calendar: JTACMonthView, didDeselectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
Function calendar
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func calendar(_ calendar: JTACMonthView, didSelectDate date: Date, cell: JTACDayCell?, cellState: CellState, indexPath: IndexPath) {
Function navigationController
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
func navigationController(_ navigationController: UINavigationController, animationControllerFor operation: UINavigationController.Operation, from fromVC: UIViewController, to toVC: UIViewController) -> UIViewControllerAnimatedTransitioning? {
guard let view = self.navigationController?.view else { return nil }
// This function calls a custom segue animation when transitioning to an instance of FilterViewController
switch operation {
case .push:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function start
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
override func start() {
state = .isExecuting
guard
let urlString = (event.image),
let url = URL(string: urlString)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function prepare
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
guard let detailVC = segue.destination as? EventDetailViewController else { return }
// detailVC.controller = controller
if segue.identifier == "ShowDetailFromTable" {
guard let indexPath = eventResultsTableView.indexPathForSelectedRow else { return }
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getState
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
static func getState(withAuthRequest authRequest: OIDAuthorizationRequest, callback: @escaping (OIDAuthState?, OktaOidcError?) -> Void ) {
let finalize: ((OIDAuthState?, OktaOidcError?) -> Void) = { state, error in
callback(state, error)
}
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
guard let resultsVC = segue.destination as? SearchResultViewController else { return }
Avoid too many return
statements within this function. Open
return UICollectionViewCell()
Avoid too many return
statements within this function. Open
return nil