Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-1355

Reduce the complexity of the biggest functions

    XMLWordPrintable

    Details

    • Completion Level (0 to 5):
      2

      Description

      When computing the cyclomatic complexity of the project with radon, we have a list of 41 methods or functions with a C rating or worse. 5 of them have an F rating, which is the worst.
      We should aim to reduce this number by breaking down big functions into smaller ones.

      Here is the output of the radon cc nxdrive -nc command:

      nxdrive/direct_edit.py
          M 598:4 DirectEdit._handle_upload_queue - C
          M 347:4 DirectEdit._prepare_edit - C
          M 773:4 DirectEdit.handle_watchdog_event - C
          M 538:4 DirectEdit._handle_lock_queue - C
      nxdrive/utils.py
          F 339:0 version_compare - C
          F 722:0 guess_server_url - C
          M 964:4 PidLockFile.check_running - C
      nxdrive/manager.py
          M 612:4 Manager.bind_engine - C
          M 73:4 Manager.__init__ - C
      nxdrive/options.py
          M 256:4 MetaOptions.set - E
      nxdrive/updater/base.py
          M 190:4 BaseUpdater._get_update_status - C
      nxdrive/gui/view.py
          M 328:4 FileModel.data - C
          M 86:4 EngineModel.data - C
          M 112:4 EngineModel.get - C
      nxdrive/gui/api.py
          M 482:4 QMLDriveApi.bind_server - C
      nxdrive/engine/processor.py
          M 138:4 Processor._execute - F
          M 571:4 Processor._synchronize_locally_created - F
          M 1116:4 Processor._synchronize_remotely_created - C
          M 853:4 Processor._synchronize_locally_moved - C
          M 1016:4 Processor._synchronize_remotely_modified - C
          M 450:4 Processor._synchronize_if_not_remotely_dirty - C
          M 486:4 Processor._synchronize_locally_modified - C
      nxdrive/engine/engine.py
          M 971:4 Engine.get_user_full_name - C
          M 934:4 Engine.suspend_client - C
      nxdrive/engine/queue_manager.py
          M 478:4 QueueManager.launch_processors - D
          M 331:4 QueueManager._thread_finished - C
          M 439:4 QueueManager.get_processors_on - C
      nxdrive/engine/dao/sqlite.py
          M 1613:4 EngineDAO.update_remote_state - D
      nxdrive/engine/watcher/remote_watcher.py
          M 677:4 RemoteWatcher._update_remote_states - F
          M 425:4 RemoteWatcher._find_remote_child_match_or_create - D
          M 202:4 RemoteWatcher._scan_remote_scroll - C
          M 335:4 RemoteWatcher._scan_remote_recursive - C
          M 574:4 RemoteWatcher._handle_changes - C
          M 117:4 RemoteWatcher._scan_pair - C
      nxdrive/engine/watcher/local_watcher.py
          M 907:4 LocalWatcher.handle_watchdog_event - F
          M 303:4 LocalWatcher._scan_recursive - F
          M 682:4 LocalWatcher._handle_move_on_known_pair - C
          M 815:4 LocalWatcher._handle_watchdog_event_on_known_acquired_pair - C
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                PagerDuty