Lambda-School-Labs/community-calendar-ios

View on GitHub

Showing 254 of 254 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      public static let selections: [GraphQLSelection] = [
        GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
        GraphQLField("rsvps", type: .list(.nonNull(.object(Rsvp.selections)))),
      ]
Severity: Major
Found in Community Calendar/Community Calendar/API.swift and 1 other location - About 1 hr to fix
Community Calendar/Community Calendar/API.swift on lines 1184..1187

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

      public static let selections: [GraphQLSelection] = [
        GraphQLField("__typename", type: .nonNull(.scalar(String.self))),
        GraphQLField("createdEvents", type: .list(.nonNull(.object(CreatedEvent.selections)))),
      ]
Severity: Major
Found in Community Calendar/Community Calendar/API.swift and 1 other location - About 1 hr to fix
Community Calendar/Community Calendar/API.swift on lines 624..627

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 71.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function anchor has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    func anchor(top: NSLayoutYAxisAnchor?, leading: NSLayoutXAxisAnchor?, trailing: NSLayoutXAxisAnchor?, bottom: NSLayoutYAxisAnchor?, centerX: NSLayoutXAxisAnchor?, centerY: NSLayoutYAxisAnchor?, padding: UIEdgeInsets = .zero, size: CGSize = .zero) {

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    struct DateRangeFilter: Codable, Equatable {
        init(dateRange: (Date, Date)) {
            self.min = dateRange.0
            self.max = dateRange.1
        }
    Severity: Major
    Found in Community Calendar/Community Calendar/Models/Filter.swift and 1 other location - About 1 hr to fix
    Community Calendar/Community Calendar/Models/Filter.swift on lines 74..82

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 70.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    struct TicketPriceFilter: Codable, Equatable {
        init(ticketFilter: (Int, Int)) {
            self.min = ticketFilter.0
            self.max = ticketFilter.1
        }
    Severity: Major
    Found in Community Calendar/Community Calendar/Models/Filter.swift and 1 other location - About 1 hr to fix
    Community Calendar/Community Calendar/Models/Filter.swift on lines 84..92

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 70.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        @IBAction func collectionViewButtonTapped(_ sender: UIButton) {
            eventCollectionView.isHidden = false
            eventTableView.isHidden = true
            eventCollectionView.reloadData()
            tableViewButton.imageView?.image = UIImage(named: "list")
    Community Calendar/Community Calendar/View Controllers/HomeViewController.swift on lines 254..260
    Community Calendar/Community Calendar/View Controllers/SearchResultViewController.swift on lines 126..132
    Community Calendar/Community Calendar/View Controllers/SearchResultViewController.swift on lines 134..140

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        @IBAction func tableViewPressed(_ sender: UIButton) {
            eventResultsCollectionView.isHidden = true
            eventResultsTableView.isHidden = false
            eventResultsTableView.reloadData()
            tableViewButton.imageView?.image = UIImage(named: "list-selected")
    Community Calendar/Community Calendar/View Controllers/HomeViewController.swift on lines 254..260
    Community Calendar/Community Calendar/View Controllers/HomeViewController.swift on lines 262..268
    Community Calendar/Community Calendar/View Controllers/SearchResultViewController.swift on lines 134..140

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        @IBAction func tableViewButtonTapped(_ sender: UIButton) {
            eventCollectionView.isHidden = true
            eventTableView.isHidden = false
            eventTableView.reloadData()
            tableViewButton.imageView?.image = UIImage(named: "list-selected")
    Community Calendar/Community Calendar/View Controllers/HomeViewController.swift on lines 262..268
    Community Calendar/Community Calendar/View Controllers/SearchResultViewController.swift on lines 126..132
    Community Calendar/Community Calendar/View Controllers/SearchResultViewController.swift on lines 134..140

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        @IBAction func collectionViewPressed(_ sender: UIButton) {
            eventResultsTableView.isHidden = true
            eventResultsCollectionView.isHidden = false
            eventResultsCollectionView.reloadData()
            tableViewButton.imageView?.image = UIImage(named: "list")
    Community Calendar/Community Calendar/View Controllers/HomeViewController.swift on lines 254..260
    Community Calendar/Community Calendar/View Controllers/HomeViewController.swift on lines 262..268
    Community Calendar/Community Calendar/View Controllers/SearchResultViewController.swift on lines 126..132

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 69.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        init?(creator: FetchUserIdQuery.Data.User.Rsvp.Creator) {
            
            guard
                let firstName = creator.firstName,
                let lastName = creator.lastName,
    Severity: Major
    Found in Community Calendar/Community Calendar/Models/Creator.swift and 2 other locations - About 55 mins to fix
    Community Calendar/Community Calendar/Models/Creator.swift on lines 51..63
    Community Calendar/Community Calendar/Models/Creator.swift on lines 65..77

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        init?(creator: FetchUserIdQuery.Data.User.Saved.Creator) {
            
            guard
                let firstName = creator.firstName,
                let lastName = creator.lastName,
    Severity: Major
    Found in Community Calendar/Community Calendar/Models/Creator.swift and 2 other locations - About 55 mins to fix
    Community Calendar/Community Calendar/Models/Creator.swift on lines 37..49
    Community Calendar/Community Calendar/Models/Creator.swift on lines 65..77

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 3 locations. Consider refactoring.
    Open

        init?(creator: FetchUserIdQuery.Data.User.CreatedEvent.Creator) {
            
            guard
                let firstName = creator.firstName,
                let lastName = creator.lastName,
    Severity: Major
    Found in Community Calendar/Community Calendar/Models/Creator.swift and 2 other locations - About 55 mins to fix
    Community Calendar/Community Calendar/Models/Creator.swift on lines 37..49
    Community Calendar/Community Calendar/Models/Creator.swift on lines 51..63

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 67.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        func signOutOfOkta(with options: OktaSignOutOptions,
                           failedOptions: OktaSignOutOptions,
                           progressHandler: @escaping ((OktaSignOutOptions) -> Void),
                           completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
            // override
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/OktaOidcSignOutHandler.swift on lines 25..88
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/iOS/OktaOidcSignOutHandlerIOS.swift on lines 26..43
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/iOS/OktaOidc+Browser.swift on lines 36..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        func signOut(with options: OktaSignOutOptions,
                     failedOptions: OktaSignOutOptions,
                     progressHandler: @escaping ((OktaSignOutOptions) -> Void),
                     completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
            if options.isEmpty {
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/OktaOidcSignOutHandler.swift on lines 90..102
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/iOS/OktaOidcSignOutHandlerIOS.swift on lines 26..43
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/iOS/OktaOidc+Browser.swift on lines 36..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        override func signOutOfOkta(with options: OktaSignOutOptions,
                                    failedOptions: OktaSignOutOptions,
                                    progressHandler: @escaping ((OktaSignOutOptions) -> Void),
                                    completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
            var notFinishedOptions: OktaSignOutOptions = options
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/OktaOidcSignOutHandler.swift on lines 25..88
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/OktaOidcSignOutHandler.swift on lines 90..102
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/iOS/OktaOidc+Browser.swift on lines 36..45

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 4 locations. Consider refactoring.
    Open

        public func signOut(authStateManager: OktaOidcStateManager,
                            from presenter: UIViewController,
                            progressHandler: @escaping ((OktaSignOutOptions) -> Void),
                            completionHandler: @escaping ((Bool, OktaSignOutOptions) -> Void)) {
            self.signOut(with: .allOptions,
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/OktaOidcSignOutHandler.swift on lines 25..88
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/OktaOidcSignOutHandler.swift on lines 90..102
    Community Calendar/Pods/OktaOidc/Okta/OktaOidc/Internal/iOS/OktaOidcSignOutHandlerIOS.swift on lines 26..43

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function perform has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        static func perform(authRequest: OIDAuthorizationRequest, callback: @escaping OIDAuthorizationCallback) {
            var urlRequest = URLRequest(url: authRequest.externalUserAgentRequestURL())
            urlRequest.httpMethod = "GET"
            urlRequest.allHTTPHeaderFields = [
                "Accept": "application/json",

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

        func fetchEvents(completion: @escaping (Swift.Result<[FetchEventsQuery.Data.Event], Error>) -> Void) {
            apollo.fetch(query: FetchEventsQuery(), cachePolicy: .returnCacheDataElseFetch) { result in
                switch result {
                case .failure(let error):
                    print("Error fetching events: \(error)")

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

        func signIn(callback: @escaping ((OIDAuthState?, OktaOidcError?) -> Void)) {
            self.downloadOidcConfiguration() { oidConfig, error in
                guard let oidConfiguration = oidConfig else {
                    callback(nil, error)
                    return

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

        func signOutWithIdToken(idToken: String,
                                callback: @escaping (Void?, OktaOidcError?) -> Void) {
            self.downloadOidcConfiguration() { oidConfig, error in
                guard let oidConfig = oidConfig else {
                    callback(nil, error)

    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