atlassian/localstack

View on GitHub

Showing 144 of 195 total issues

File lambda_api.py has 601 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python
from __future__ import print_function

import os
import re
Severity: Major
Found in localstack/services/awslambda/lambda_api.py - About 1 day to fix

    Function update_sns has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring.
    Open

    def update_sns(method, path, data, headers, response=None, return_forward_info=False):
        if return_forward_info:
            if method == 'POST' and path == '/':
                req_data = urlparse.parse_qs(data)
                req_action = req_data['Action'][0]
    Severity: Minor
    Found in localstack/services/sns/sns_listener.py - About 1 day 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 retrieve_resource_details has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    def retrieve_resource_details(resource_id, resource_status, resources, stack_name):
        resource = resources[resource_id]
        resource_id = resource_status.get('PhysicalResourceId') or resource_id
        resource_type = resource_status['ResourceType']
        if not resource:
    Severity: Minor
    Found in localstack/utils/cloudformation/template_deployer.py - About 7 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 common.py has 431 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import print_function
    
    import threading
    import traceback
    import os
    Severity: Minor
    Found in localstack/utils/common.py - About 6 hrs to fix

      File template_deployer.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import json
      import yaml
      import logging
      import traceback
      from threading import local
      Severity: Minor
      Found in localstack/utils/cloudformation/template_deployer.py - About 6 hrs to fix

        File infra.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import re
        import os
        import json
        import logging
        import base64
        Severity: Minor
        Found in localstack/dashboard/infra.py - About 5 hrs to fix

          Function update_cloudformation has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          def update_cloudformation(method, path, data, headers, response=None, return_forward_info=False):
              req_data = None
              if method == 'POST' and path == '/':
                  req_data = urlparse.parse_qs(data)
                  action = req_data.get('Action')[0]
          Severity: Minor
          Found in localstack/services/cloudformation/cloudformation_listener.py - About 5 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 extract_endpoints has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          def extract_endpoints(code_map, pool={}):
              result = []
              identifiers = []
              for key, code in iteritems(code_map):
                  # Elasticsearch references
          Severity: Minor
          Found in localstack/dashboard/infra.py - About 5 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 send_notifications has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
          Open

          def send_notifications(method, bucket_name, object_path):
              for bucket, config in iteritems(S3_NOTIFICATIONS):
                  if bucket == bucket_name:
                      action = {'PUT': 'ObjectCreated', 'DELETE': 'ObjectRemoved'}[method]
                      # TODO: support more detailed methods, e.g., DeleteMarkerCreated
          Severity: Minor
          Found in localstack/services/s3/s3_listener.py - About 5 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 aws_stack.py has 399 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import os
          import boto3
          import json
          import base64
          import logging
          Severity: Minor
          Found in localstack/utils/aws/aws_stack.py - About 5 hrs to fix

            Function drawGraph has 136 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var drawGraph = function() {
            
                  if(!graphData) return;
            
                  canvas.html('');
            Severity: Major
            Found in localstack/dashboard/web/views/infra.graph.js - About 5 hrs to fix

              Function get_graph has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_graph(name_filter='.*', env=None):
                  result = {
                      'nodes': [],
                      'edges': []
                  }
              Severity: Minor
              Found in localstack/dashboard/infra.py - About 5 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 update_apigateway has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

              def update_apigateway(method, path, data, headers, response=None, return_forward_info=False):
                  if return_forward_info:
              
                      regex2 = r'^/restapis/([A-Za-z0-9_\-]+)/([A-Za-z0-9_\-]+)/%s/(.*)$' % PATH_USER_REQUEST
                      if re.match(regex2, path):
              Severity: Minor
              Found in localstack/services/apigateway/apigateway_listener.py - About 5 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 forward has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
              Open

                  def forward(self, method):
                      path = self.path
                      if '://' in path:
                          path = '/' + path.split('://', 1)[1].split('/', 1)[1]
                      proxy_url = 'http://%s%s' % (self.proxy.forward_host, path)
              Severity: Minor
              Found in localstack/services/generic_proxy.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 update_s3 has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              def update_s3(method, path, data, headers, response=None, return_forward_info=False):
              
                  if return_forward_info:
              
                      modified_data = None
              Severity: Minor
              Found in localstack/services/s3/s3_listener.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 update_dynamodb has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
              Open

              def update_dynamodb(method, path, data, headers, response=None, return_forward_info=False):
                  if return_forward_info:
                      if random.random() < config.DYNAMODB_ERROR_PROBABILITY:
                          return dynamodb_error_response(data)
                      return True
              Severity: Minor
              Found in localstack/services/dynamodb/dynamodb_listener.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 kinesis_connector.py has 351 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              #!/usr/bin/env python
              
              import os
              import sys
              import re
              Severity: Minor
              Found in localstack/utils/kinesis/kinesis_connector.py - About 4 hrs to fix

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

                def deploy_resource(resource_id, resources, stack_name):
                    resource = resources[resource_id]
                    client = get_client(resource)
                    if not client:
                        return False
                Severity: Minor
                Found in localstack/utils/cloudformation/template_deployer.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 applyExtras has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    joint.applyExtras = function(graph, paper, params) {
                        if(!params) params = {};
                
                        /* returnestrict children to parent's bounding box*/
                        graph.on('change:position', function(cell, newPosition, opt) {
                Severity: Major
                Found in localstack/dashboard/web/js/joint.defs.js - About 3 hrs to fix

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

                  def find_object(expected_object, object_list):
                      for obj in object_list:
                          if isinstance(obj, list):
                              found = find_object(expected_object, obj)
                              if found:
                  Severity: Minor
                  Found in localstack/utils/testutil.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

                  Severity
                  Category
                  Status
                  Source
                  Language