xybu/onedrived-dev

View on GitHub

Showing 56 of 166 total issues

Function _handle_remote_item has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def _handle_remote_item(self, remote_item, all_local_items, all_records):
"""
:param onedrivesdk.model.item.Item remote_item:
:param [str] all_local_items:
:param dict(str, onedrived.od_repo.ItemRecord) all_records:
Severity: Minor
Found in onedrived/od_tasks/merge_dir.py - About 1 hr to fix

Function ensure_remote_path_is_dir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def ensure_remote_path_is_dir(self, repo, rel_path):
"""
Make sure the path is a folder in remote repository. If the path does not exist, create it. If the path is a
file, rename the file and create the dir. Return False if the remote path can't be made a dir.
:param onedrived.od_repo.OneDriveLocalRepository repo:
Severity: Minor
Found in onedrived/od_watcher.py - About 1 hr to fix

Function _handle_remote_file_without_record has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def _handle_remote_file_without_record(self, remote_item, item_stat, item_local_abspath, all_local_items):
"""
Handle the case in which a remote item is not found in the database. The local item may or may not exist.
:param onedrivesdk.model.item.Item remote_item:
:param posix.stat_result | None item_stat:
Severity: Minor
Found in onedrived/od_tasks/merge_dir.py - About 1 hr to fix

Function item_request_call has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def item_request_call(repo, request_func, *args, **kwargs):
while True:
try:
return request_func(*args, **kwargs)
except onedrivesdk.error.OneDriveError as e:
Severity: Minor
Found in onedrived/od_api_helper.py - About 1 hr to fix

Function rename_with_suffix has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def rename_with_suffix(parent_abspath, name, host_name):
suffix = ' (' + host_name + ')'
parent_abspath = parent_abspath + '/'
 
# Calculate the file name without suffix.
Severity: Minor
Found in onedrived/od_tasks/merge_dir.py - About 1 hr to fix

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

def __init__(self, repo, task_pool, parent_relpath, item_name,
Severity: Major
Found in onedrived/od_tasks/move_item.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

    if (item_is_folder and not event_is_dir) or (item_is_file and event_is_dir):
    # Path is a dir remotely but a file locally, or a file remotely but a dir locally.
    # To solve the type conflict we try renaming the remote item, and if it succeeds, proceed as if
    # the remote item does not exist; otherwise fall back to dir merge.
    new_name = get_filename_with_incremented_count(item.name)
    Severity: Major
    Found in onedrived/od_watcher.py - About 1 hr to fix

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

      def _handle_unpaired_move_from(self, from_ev, from_flags, from_parent_dir=None, from_parent_relpath=None,
      from_repo=None, from_item_record=None):
      """
      :param inotify_simple.Event from_ev:
      :param [inotify_simple.flags] from_flags:
      Severity: Minor
      Found in onedrived/od_watcher.py - About 55 mins to fix

      Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def __init__(self, repo, task_pool, rel_path, item_request, deep_merge=True,
      Severity: Major
      Found in onedrived/od_tasks/merge_dir.py - About 50 mins to fix

        Function _handle_remote_folder has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def _handle_remote_folder(self, remote_item, item_local_abspath, record, all_local_items):
        if not self.deep_merge:
        return
        try:
        remote_dir_matches_record = self._remote_dir_matches_record(remote_item, record)
        Severity: Minor
        Found in onedrived/od_tasks/merge_dir.py - About 45 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def __init__(self, repo, task_pool, item_name, parent_relpath, upload_if_success=True, abort_if_local_gone=True):
        Severity: Minor
        Found in onedrived/od_tasks/merge_dir.py - About 45 mins to fix

          Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def __init__(self, repo, task_pool, parent_relpath, item_name, item_id=None, is_folder=False):
          Severity: Minor
          Found in onedrived/od_tasks/delete_item.py - About 45 mins to fix

            Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def __init__(self, repo, task_pool, parent_relpath, item_name, item_id=None, is_folder=False):
            Severity: Minor
            Found in onedrived/od_tasks/update_item_base.py - About 45 mins to fix

              Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def __init__(self, repo, task_pool, parent_relpath, item_name, item_id=None, is_folder=False):
              Severity: Minor
              Found in onedrived/od_tasks/update_mtime.py - About 45 mins to fix

                Function _handle_unpaired_move_from has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def _handle_unpaired_move_from(self, from_ev, from_flags, from_parent_dir=None, from_parent_relpath=None,
                Severity: Minor
                Found in onedrived/od_watcher.py - About 45 mins to fix

                  Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def __init__(self, repo, task_pool, parent_dir_request, parent_relpath, item_name):
                  Severity: Minor
                  Found in onedrived/od_tasks/upload_file.py - About 35 mins to fix

                    Function _handle_unpaired_move_to has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    def _handle_unpaired_move_to(self, to_ev, to_flags, to_repo,
                    Severity: Minor
                    Found in onedrived/od_watcher.py - About 35 mins to fix

                      Function _handle_remote_file_with_record has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def _handle_remote_file_with_record(self, remote_item, item_record, item_stat, item_local_abspath, all_local_items):
                      Severity: Minor
                      Found in onedrived/od_tasks/merge_dir.py - About 35 mins to fix

                        Function move_item has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def move_item(self, item_name, parent_relpath, new_name, new_parent_relpath, is_folder=False):
                        Severity: Minor
                        Found in onedrived/od_repo.py - About 35 mins to fix

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

                          def shutdown_workers():
                          for w in task_workers:
                          if w:
                          w.stop()
                          if task_pool:
                          Severity: Minor
                          Found in onedrived/od_main.py - About 35 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language