cforlando/orlando-walking-tours-ios

View on GitHub

Showing 27 of 47 total issues

Avoid deeply nested control flow statements.
Open

                            if let localRegistryDate = subJson["local"].string
                            {
                                location.localRegistryDate = DateFormatter().date(from: localRegistryDate) as NSDate?
                            }
Severity: Major
Found in Orlando Walking Tours/Services/SocrataDataService.swift - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                if let latitude = locationJSON["location"]["latitude"].double,
                                   let longitude = locationJSON["location"]["longitude"].double
                                {
                                    location.latitude = latitude as NSNumber
                                    location.longitude = longitude as NSNumber
    Severity: Major
    Found in Orlando Walking Tours/Services/FirebaseDataService.swift - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                                  if let locationType = subJson["type"].string
                                  {
                                      location.locationType = locationType
                                  }
      Severity: Major
      Found in Orlando Walking Tours/Services/SocrataDataService.swift - About 45 mins to fix

        Function prepare has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            override func prepare(for segue: UIStoryboardSegue, sender: Any?)
            {
                super.prepare(for: segue, sender: sender)
        
                if let navController = segue.destination as? UINavigationController
        Severity: Minor
        Found in Orlando Walking Tours/Controllers/CurrentTourVC.swift - About 35 mins to fix

        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?)
            {
                super.prepare(for: segue, sender: sender)
        
                if let navController = segue.destination as? UINavigationController
        Severity: Minor
        Found in Orlando Walking Tours/Controllers/LocationListVC.swift - About 35 mins to fix

        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 displayTour has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            func displayTour()
            {
                if let tour = self.tour
                {
                    let locationsByOrder = tour.historicLocations?.sorted(by: {
        Severity: Minor
        Found in Orlando Walking Tours/Controllers/LocationListVC.swift - About 25 mins to fix

        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 6 (exceeds 5 allowed). Consider refactoring.
        Open

            override func prepare(for segue: UIStoryboardSegue, sender: Any?)
            {
                if segue.identifier == "ShowLocationListSegue"
                {
                    if let navController = segue.destination as? UINavigationController,
        Severity: Minor
        Found in Orlando Walking Tours/Controllers/AddTourVC.swift - About 25 mins to fix

        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

        Severity
        Category
        Status
        Source
        Language