scitran/core

View on GitHub

Showing 294 of 518 total issues

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

module.exports = function(grunt) {
    loadTasks(grunt);
    grunt.task.loadTasks('support/tasks/');

    grunt.task.registerTask('createBuildDir', function() {
Severity: Major
Found in swagger/Gruntfile.js - About 4 hrs to fix

    Function generate_request has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

        def generate_request(self, gear):
            """
            Generate the job's request, save it to the class, and return it
    
            Parameters
    Severity: Minor
    Found in api/jobs/jobs.py - About 4 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_container has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def default_container(handler, container=None, target_parent_container=None):
        """
        This is the default permissions checker generator.
        The resulting permissions checker modifies the exec_op method by checking the user permissions
        on the container before actually executing this method.
    Severity: Minor
    Found in api/auth/containerauth.py - About 4 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 _build_month_report has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

        def _build_month_report(self, base_query):
            """
            Builds a usage report for file size, session count and gear execution count
            Aggregates this information by month.
    
    
    Severity: Minor
    Found in api/handlers/reporthandler.py - About 4 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 refererhandler.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    """
    Module defining RefererHandler and it's subclasses. RefererHandler
    generalizes the handling of documents that are not part of the container
    hierarchy, are always associated with (referencing) a parent container,
    and are stored in their own collection instead of an embedded list on the
    Severity: Minor
    Found in api/handlers/refererhandler.py - About 4 hrs to fix

      Function eval_match has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      def eval_match(match_type, match_param, file_, container, regex=False):
          """
          Given a match entry, return if the match succeeded.
          """
      
      
      Severity: Minor
      Found in api/jobs/rules.py - About 4 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 undelete has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      def undelete(cont_name, cont_id, filename=None, include_parents=False, always_propagate=False):
          if cont_name not in cont_names:
              raise ValueError('Invalid cont_name "{}" (must be one of {})'.format(cont_name, cont_names_str))
          if not bson.ObjectId.is_valid(cont_id):
              raise ValueError('Invalid cont_id "{}" (must be parseable ObjectId)'.format(cont_id))
      Severity: Minor
      Found in bin/undelete.py - About 4 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 download.py has 345 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import bson
      import pytz
      import os.path
      import tarfile
      import datetime
      Severity: Minor
      Found in api/download.py - About 4 hrs to fix

        File jobs.py has 344 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        """
        Jobs
        """
        
        import bson
        Severity: Minor
        Found in api/jobs/jobs.py - About 4 hrs to fix

          Function post has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def post(self):
                  """
                  Create a batch job proposal, insert as 'pending' if there are matched containers
                  """
          
          
          Severity: Minor
          Found in api/jobs/handlers.py - About 4 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_config has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_config(self, _id):
                  """Get a job's config"""
                  j = Job.get(_id)
                  c = j.config
                  if c is None:
          Severity: Minor
          Found in api/jobs/handlers.py - About 4 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_16 has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

          def upgrade_to_16():
              """
              Fixes file.size sometimes being a floating-point rather than integer.
              """
          
          
          Severity: Minor
          Found in bin/database.py - About 4 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 check has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              def check(self):
                  self.requireTarget()
          
                  # Check that required state exists
                  if self.context.get('job_id'):
          Severity: Minor
          Found in api/placer.py - About 4 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 base.py has 333 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import base64
          import datetime
          import jsonschema
          import os
          import pymongo
          Severity: Minor
          Found in api/web/base.py - About 4 hrs to fix

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

                def update_el(self, _id, payload, unset_payload=None, recursive=False, r_payload=None, replace_metadata=False):
                    session = self.get_container(_id)
                    if session is None:
                        raise APINotFoundException('Could not find session {}'.format(_id))
            
            
            Severity: Minor
            Found in api/dao/containerstorage.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 draft4ToOpenApi2 has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

            SchemaTranspiler.prototype.draft4ToOpenApi2 = function(schema, defs, id) {
                var ref, defname;
            
                // Drop the $schema property, and make a copy
                schema = _.omit(schema, OMITTED_PROPERTIES);
            Severity: Minor
            Found in swagger/support/schema-transpiler.js - 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 log_user_access has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
            Open

                def log_user_access(self, access_type, cont_name=None, cont_id=None, filename=None, multifile=False, origin_override=None):
            
                    if not config.get_item('core', 'access_log_enabled'):
                        return
            
            
            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

            File queue.py has 316 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            """
            A simple FIFO queue for jobs.
            """
            
            import bson
            Severity: Minor
            Found in api/jobs/queue.py - About 3 hrs to fix

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

                  def _append_targets(self, targets, cont_name, container, prefix, total_size, total_cnt, data_path, filters):
                      inputs = [('input', f) for f in container.get('inputs', [])]
                      outputs = [('output', f) for f in container.get('files', [])]
                      for file_group, f in inputs + outputs:
                          if filters:
              Severity: Minor
              Found in api/download.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 resolveRefs has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
              Open

              Schemas.prototype.resolveRefs = function(relpath, obj, jsonpath) {
                  var $ref, parts, curpath, actualpath, pathpart;
                  // Ignore examples
                  if( jsonpath && jsonpath[jsonpath.length-1] === 'example' ) {
                      return obj;
              Severity: Minor
              Found in swagger/support/schemas.js - 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

              Severity
              Category
              Status
              Source
              Language