hlfcoding/Eventual

View on GitHub

Showing 231 of 231 total issues

File EventViewController.swift has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import UIKit
import EventKit

import MapKit

Severity: Minor
Found in Eventual/Eventual/EventViewController.swift - About 7 hrs to fix

    File MonthsViewController.swift has 394 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import UIKit
    import EventKit
    
    final class MonthsViewController: UICollectionViewController, MonthsScreen,
    CollectionViewTraitDelegate {
    Severity: Minor
    Found in Eventual/Eventual/MonthsViewController.swift - About 5 hrs to fix

      File ZoomTransition.swift has 391 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import UIKit
      import QuartzCore
      
      enum ZoomTransitionFrameFitting: String {
          case zoomedInAspectFittingZoomedOut
      Severity: Minor
      Found in Eventual/Eventual/ZoomTransition.swift - About 5 hrs to fix

        Function sync has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            @objc private func sync(_ sender: CADisplayLink) {
                guard collectionView.contentOffset.y >= 0,
                    collectionView.contentOffset.y != collectionView.previousContentOffset?.y
                    else { return }
        
        
        Severity: Minor
        Found in Eventual/Eventual/CollectionViewTitleScrollSyncTrait.swift - About 5 hrs 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

        File TitleScrollView.swift has 319 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import UIKit
        import QuartzCore
        
        enum TitleItemType {
        
        
        Severity: Minor
        Found in Eventual/Eventual/TitleScrollView.swift - About 3 hrs to fix

          Function transitionFocus has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              override func transitionFocus(to view: UIView?, from currentView: UIView? = nil,
                                            completion: (() -> Void)? = nil) {
                  let isPicker = (from: currentView is UIDatePicker, to: view is UIDatePicker)
                  let shouldToggleDrawer = isPicker.from || isPicker.to && !(isPicker.from && isPicker.to)
                  var toggleDrawerDelay: TimeInterval?
          Severity: Minor
          Found in Eventual/Eventual/EventViewController.swift - About 3 hrs 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

          FormViewController has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class FormViewController: UIViewController, FormDataSourceDelegate, FormFocusStateDelegate {
          
              // MARK: - UIViewController
          
              override func viewDidLoad() {
          Severity: Minor
          Found in Eventual/Eventual/FormViewController.swift - About 3 hrs to fix

            EventViewController has 28 methods (exceeds 20 allowed). Consider refactoring.
            Open

            final class EventViewController: FormViewController, EventScreen {
            
                // MARK: CoordinatedViewController
            
                weak var currentSegue: UIStoryboardSegue?
            Severity: Minor
            Found in Eventual/Eventual/EventViewController.swift - About 3 hrs to fix

              Function indexPathUpdatesForEvent has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  func indexPathUpdatesForEvent(newInfo: EventWithChangeInfo,
                                                oldInfo: EventWithChangeInfo) -> SelectiveUpdatingInfo {
                      var paths = (deletions: [IndexPath](), insertions: [IndexPath](), reloads: [IndexPath](),
                                   sectionDeletions: IndexSet(), sectionInsertions: IndexSet())
              
              
              Severity: Minor
              Found in Eventual/Eventual/EventCollections.swift - About 3 hrs 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

              File DayViewController.swift has 292 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import UIKit
              import EventKit
              
              final class DayViewController: UICollectionViewController, DayScreen {
              
              
              Severity: Minor
              Found in Eventual/Eventual/DayViewController.swift - About 3 hrs to fix

                Function handleLongPress has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                Open

                    @objc private func handleLongPress(_ sender: UILongPressGestureRecognizer) {
                        guard sender === longPressRecognizer else { preconditionFailure() }
                        let location = longPressRecognizer.location(in: collectionView)
                
                        let handleReattach = { (cell: UICollectionViewCell, indexPath: IndexPath) in
                Severity: Minor
                Found in Eventual/Eventual/CollectionViewDragDropDeletionTrait.swift - About 2 hrs 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 sync has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @objc private func sync(_ sender: CADisplayLink) {
                        guard collectionView.contentOffset.y >= 0,
                            collectionView.contentOffset.y != collectionView.previousContentOffset?.y
                            else { return }
                
                
                Severity: Major
                Found in Eventual/Eventual/CollectionViewTitleScrollSyncTrait.swift - About 2 hrs to fix

                  Function handleLongPress has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @objc private func handleLongPress(_ sender: UILongPressGestureRecognizer) {
                          guard sender === longPressRecognizer else { preconditionFailure() }
                          let location = longPressRecognizer.location(in: collectionView)
                  
                          let handleReattach = { (cell: UICollectionViewCell, indexPath: IndexPath) in
                  Severity: Major
                  Found in Eventual/Eventual/CollectionViewDragDropDeletionTrait.swift - About 2 hrs to fix

                    Function handlePan has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        @objc private func handlePan(_ sender: UIPanGestureRecognizer) {
                            let translation = sender.translation(in: sender.view!.superview!)
                            let velocity = sender.velocity(in: sender.view!)
                            switch sender.state {
                            case .began:
                    Severity: Minor
                    Found in Eventual/Eventual/CarouselTransition.swift - About 2 hrs 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 prepareSegueForDescendant has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        override func prepareSegueForDescendant(_ sender: Any?) {
                            super.prepareSegueForDescendant(sender)
                    
                            let viewController = sender as! CoordinatedViewController
                            let (type, destination, source, destinationContainer, sourceContainer) =
                    Severity: Major
                    Found in Eventual/Eventual/MonthEventNavigationController.swift - About 2 hrs to fix

                      EventCollectionsTests has 21 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                      final class EventCollectionsTests: XCTestCase {
                      
                          lazy var tomorrowEvents: [TestEvent] = [
                              TestEvent(identifier: "Tomorrow-0", startDate: tomorrow),
                              TestEvent(identifier: "Tomorrow-1", startDate: tomorrow),
                      Severity: Minor
                      Found in Eventual/Eventual Unit Tests/EventCollectionsTests.swift - About 2 hrs to fix

                        Function prepareSegueForDescendant has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                        Open

                            override func prepareSegueForDescendant(_ sender: Any?) {
                                super.prepareSegueForDescendant(sender)
                        
                                let viewController = sender as! CoordinatedViewController
                                let (type, destination, source, destinationContainer, sourceContainer) =
                        Severity: Minor
                        Found in Eventual/Eventual/MonthEventNavigationController.swift - About 1 hr 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 indexPathUpdatesForEvent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            func indexPathUpdatesForEvent(newInfo: EventWithChangeInfo,
                                                          oldInfo: EventWithChangeInfo) -> SelectiveUpdatingInfo {
                                var paths = (deletions: [IndexPath](), insertions: [IndexPath](), reloads: [IndexPath](),
                                             sectionDeletions: IndexSet(), sectionInsertions: IndexSet())
                        
                        
                        Severity: Minor
                        Found in Eventual/Eventual/EventCollections.swift - About 1 hr to fix

                          Function transitionFocus has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              override func transitionFocus(to view: UIView?, from currentView: UIView? = nil,
                                                            completion: (() -> Void)? = nil) {
                                  let isPicker = (from: currentView is UIDatePicker, to: view is UIDatePicker)
                                  let shouldToggleDrawer = isPicker.from || isPicker.to && !(isPicker.from && isPicker.to)
                                  var toggleDrawerDelay: TimeInterval?
                          Severity: Minor
                          Found in Eventual/Eventual/EventViewController.swift - About 1 hr to fix

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

                                override func fetch(completion: (() -> Void)? = nil) {
                                    guard beginFetch() else { return }
                            
                                    let endDate = isInvalid ? Date() : fetchCursor!
                                    let startDate = Calendar.current.date(byAdding: fetchRangeComponents, to: endDate)!
                            Severity: Major
                            Found in Eventual/Eventual/EventDataSources.swift and 1 other location - About 1 hr to fix
                            Eventual/Eventual/EventDataSources.swift on lines 249..259

                            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 113.

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language