scitran/core

View on GitHub

Showing 294 of 518 total issues

Function authenticate_user_token has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def authenticate_user_token(self, session_token):
        """
        AuthN for user accounts. Calls self.abort on failure.

        Returns the user's UID.
Severity: Minor
Found in api/web/base.py - 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

Function _handle_properties has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def _handle_properties(cls, properties, current_field_name):

        ignore_fields = [
            '_all', 'dynamic_templates', 'analysis_reference', 'file_reference',
            'parent', 'container_type', 'origin', 'permissions', '_id',
Severity: Minor
Found in api/handlers/dataexplorerhandler.py - 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

Function get_all has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all(self, cont_name, par_cont_name=None, par_id=None):
        self.config = self.container_handler_configurations[cont_name]
        self.storage = self.config['storage']

        projection = self.config['list_projection'].copy()
Severity: Minor
Found in api/handlers/containerhandler.py - 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

Function get_all_el has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def get_all_el(self, query, user, projection, fill_defaults=False):
        if query is None:
            query = {}
        if user:
            if query.get('permissions'):
Severity: Minor
Found in api/dao/basecontainerstorage.py - 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

Function exports has 79 lines of code (exceeds 25 allowed). Consider refactoring.
Open

module.exports = function(grunt) {
    var _ = require('lodash');
    var path = require('path');
    var fs = require('fs');
    var yaml = require('js-yaml');
Severity: Major
Found in swagger/support/tasks/print-doc-coverage.js - About 3 hrs to fix

    File basecontainerstorage.py has 297 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import copy
    import bson
    import datetime
    import pymongo.errors
    
    
    Severity: Minor
    Found in api/dao/basecontainerstorage.py - About 3 hrs to fix

      Function handle_origin has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_origin(self, result):
              """
              Given an object with a `files` array key, coalesce and merge file origins if requested.
              """
      
      
      Severity: Minor
      Found in api/handlers/containerhandler.py - 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 default has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def default(handler, user=None):
          def g(exec_op):
              def f(method, _id=None, query=None, payload=None, projection=None):
                  if handler.public_request:
                      handler.abort(403, 'public request is not authorized')
      Severity: Minor
      Found in api/auth/userauth.py - 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 find_matching_conts has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

      def find_matching_conts(gear, containers, container_type):
          """
          Give a gear and a list of containers, find files that:
            - have no solution to the gear's input schema (not matched)
            - have multiple solutions to the gear's input schema (ambiguous)
      Severity: Minor
      Found in api/jobs/batch.py - 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

      File authproviders.py has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import datetime
      import requests
      import json
      import urllib
      import urlparse
      Severity: Minor
      Found in api/auth/authproviders.py - About 2 hrs to fix

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

            def enqueue_job(job_map, origin, perm_check_uid=None):
                """
                Using a payload for a proposed job, creates and returns (but does not insert)
                a Job object. This preperation includes:
                  - confirms gear exists
        Severity: Minor
        Found in api/jobs/queue.py - 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 process_upload has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def process_upload(request, strategy, container_type=None, id_=None, origin=None, context=None, response=None, metadata=None):
            """
            Universal file upload entrypoint.
        
            Format:
        Severity: Minor
        Found in api/upload.py - 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 summary has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def summary(self):
                """Return a summary of what has been/will be downloaded based on a given query"""
                res = {}
                req = self.request.json_body
                cont_query = {
        Severity: Minor
        Found in api/download.py - 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 exports has 67 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(grunt) {
            var path = require('path');
            var fs = require('fs');
            var _ = require('lodash');
            var yaml = require('js-yaml');
        Severity: Major
        Found in swagger/support/tasks/validate-swagger.js - About 2 hrs to fix

          ContainerHandler has 24 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class ContainerHandler(base.RequestHandler):
              """
              This class handle operations on a generic container
          
              The pattern used is:
          Severity: Minor
          Found in api/handlers/containerhandler.py - About 2 hrs to fix

            Function modify_info has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

                def modify_info(self, _id, payload, modify_subject=False):
            
                    # Support modification of subject info
                    # Can be removed when subject becomes a standalone container
                    info_key = 'subject.info' if modify_subject else 'info'
            Severity: Minor
            Found in api/dao/basecontainerstorage.py - 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 upgrade_to_2 has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
            Open

            def upgrade_to_2():
                """
                scitran/core PR #236
            
                Set file.origin.name to id if does not exist
            Severity: Minor
            Found in bin/database.py - 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

            File config.py has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import os
            import copy
            import glob
            import json
            import logging
            Severity: Minor
            Found in api/config.py - About 2 hrs to fix

              Function exports has 63 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              module.exports = function(grunt) {
                  var fs = require('fs');
                  var path = require('path');
                  var yaml = require('js-yaml');
                  var _ = require('lodash');
              Severity: Major
              Found in swagger/support/tasks/schemas-to-defs.js - About 2 hrs to fix

                Function exports has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function(grunt) {
                    var path = require('path');
                    var fs = require('fs');
                    var yaml = require('js-yaml');
                    var resolve = require('json-refs').resolveRefs;
                Severity: Major
                Found in swagger/support/tasks/flatten-swagger.js - About 2 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language