scitran/core

View on GitHub

Showing 294 of 518 total issues

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

def dispatcher(router, request, response):
    try:
        if uwsgi is not None:
            uwsgi.set_logvar('request_id', request.id)
    except: # pylint: disable=bare-except
Severity: Minor
Found in api/web/start.py - About 45 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 get_parent_tree has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def get_parent_tree(self, _id, cont=None, projection=None, add_self=False):
        parents = []

        curr_storage = self

Severity: Minor
Found in api/dao/basecontainerstorage.py - About 45 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 _find_or_create_destination_project has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def _find_or_create_destination_project(group_id, project_label, timestamp, user):
    group_id, project_label = _group_id_fuzzy_match(group_id, project_label)
    group = config.db.groups.find_one({'_id': group_id})

    if project_label == '':
Severity: Minor
Found in api/dao/hierarchy.py - About 45 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

Avoid deeply nested control flow statements.
Open

                for a in acquisitions:
                    a.pop('info', None)
                    files = a.pop('files', [])
                    remove_blacklisted_keys(a)

Severity: Major
Found in bin/dicom_doctype.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if code is None:
                                code = 'unknown_subject'
                                subject['code'] = code
                            subject_dict[code] = subject
    Severity: Major
    Found in api/download.py - About 45 mins to fix

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

          def update_el(self, _id, payload, unset_payload=None, recursive=False, r_payload=None, replace_metadata=False):
              result = super(ProjectStorage, self).update_el(_id, payload, unset_payload=unset_payload, recursive=recursive, r_payload=r_payload, replace_metadata=replace_metadata)
      
              if result.modified_count < 1:
                  raise APINotFoundException('Could not find project {}'.format(_id))
      Severity: Minor
      Found in api/dao/containerstorage.py - About 45 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

      Consider simplifying this complex logical expression.
      Open

                  if access >= INTEGER_PERMISSIONS['admin']:
                      pass
                  elif method == 'POST' and access >= INTEGER_PERMISSIONS['rw'] and payload['user'] == handler.uid:
                      pass
                  elif method == 'GET' and (access >= INTEGER_PERMISSIONS['ro'] or container.get('public')):
      Severity: Major
      Found in api/auth/listauth.py - About 40 mins to fix

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

                def f(method, _id=None, query=None, payload=None, projection=None):
        Severity: Minor
        Found in api/auth/groupauth.py - About 35 mins to fix

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

          def eval_match(match_type, match_param, file_, container, regex=False):
          Severity: Minor
          Found in api/jobs/rules.py - About 35 mins to fix

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

                    def f(method, _id, query_params = None, payload = None, exclude_params=None):
            Severity: Minor
            Found in api/auth/listauth.py - About 35 mins to fix

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

                      def f(method, _id, query_params=None, payload=None, exclude_params=None):
              Severity: Minor
              Found in api/auth/listauth.py - About 35 mins to fix

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

                        def f(method, _id=None, query=None, payload=None, projection=None):
                Severity: Minor
                Found in api/auth/userauth.py - About 35 mins to fix

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

                          def f(method, query=None, user=None, public=False, projection=None):
                  Severity: Minor
                  Found in api/auth/containerauth.py - About 35 mins to fix

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

                            def f(method, _id, query_params = None, payload = None, exclude_params=None):
                    Severity: Minor
                    Found in api/auth/listauth.py - About 35 mins to fix

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

                              def f(method, _id, query_params = None, payload = None, exclude_params=None):
                      Severity: Minor
                      Found in api/auth/listauth.py - About 35 mins to fix

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

                                def f(method, _id, query_params = None, payload = None, exclude_params=None):
                        Severity: Minor
                        Found in api/auth/listauth.py - About 35 mins to fix

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

                                  def f(method, _id, query_params = None, payload = None, exclude_params=None):
                          Severity: Minor
                          Found in api/auth/listauth.py - About 35 mins to fix

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

                                def f(method, query=None, user=None, public=False, projection=None):
                            Severity: Minor
                            Found in api/auth/containerauth.py - About 35 mins to fix

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

                                  def create_el(self, analysis, parent_type, parent_id, origin, uid=None):
                              Severity: Minor
                              Found in api/dao/containerstorage.py - About 35 mins to fix

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

                                def try_replace_one(db, coll_name, query, update, upsert=False):
                                Severity: Minor
                                Found in api/dao/dbutil.py - About 35 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language