localstack/localstack

View on GitHub

Showing 3,170 of 3,170 total issues

OpensearchApi has 63 functions (exceeds 20 allowed). Consider refactoring.
Open

class OpensearchApi:
    service = "opensearch"
    version = "2021-01-01"

    @handler("AcceptInboundConnection")
Severity: Major
Found in localstack-core/localstack/aws/api/opensearch/__init__.py - About 1 day to fix

    File aws_s3_bucket.py has 536 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # LocalStack Resource Provider Scaffolding v2
    from __future__ import annotations
    
    import re
    from pathlib import Path

      Function determine_aws_service_model has a Cognitive Complexity of 56 (exceeds 5 allowed). Consider refactoring.
      Open

      def determine_aws_service_model(
          request: Request, services: ServiceCatalog = None
      ) -> Optional[ServiceModel]:
          """
          Tries to determine the name of the AWS service an incoming request is targeting.
      Severity: Minor
      Found in localstack-core/localstack/aws/protocol/service_router.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

      File connect.py has 529 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      """
      LocalStack client stack.
      
      This module provides the interface to perform cross-service communication between
      LocalStack providers.
      Severity: Major
      Found in localstack-core/localstack/aws/connect.py - About 1 day to fix

        File ASLIntrinsicParser.py has 517 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # Generated from ASLIntrinsicParser.g4 by ANTLR 4.13.1
        # encoding: utf-8
        from antlr4 import *
        from io import StringIO
        import sys

          File provider.py has 511 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import dataclasses
          import json
          import logging
          import os
          import re
          Severity: Major
          Found in localstack-core/localstack/services/ses/provider.py - About 1 day to fix

            File plugins.py has 510 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import abc
            import functools
            import logging
            import threading
            from collections import defaultdict
            Severity: Major
            Found in localstack-core/localstack/services/plugins.py - About 1 day to fix

              File models.py has 507 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import base64
              import datetime
              import io
              import json
              import logging
              Severity: Major
              Found in localstack-core/localstack/services/kms/models.py - About 1 day to fix

                EventsApi has 57 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class EventsApi:
                    service = "events"
                    version = "2015-10-07"
                
                    @handler("ActivateEventSource")
                Severity: Major
                Found in localstack-core/localstack/aws/api/events/__init__.py - About 1 day to fix

                  DynamodbApi has 57 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class DynamodbApi:
                      service = "dynamodb"
                      version = "2012-08-10"
                  
                      @handler("BatchExecuteStatement")
                  Severity: Major
                  Found in localstack-core/localstack/aws/api/dynamodb/__init__.py - About 1 day to fix

                    File lambda_models.py has 498 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    """Lambda models for internal use and persistence.
                    The LambdaProviderPro in localstack-ext imports this model and configures persistence.
                    The actual function code is stored in S3 (see S3Code).
                    """
                    
                    

                      Function do_run_cmd has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def do_run_cmd(self):
                              def convert_line(line):
                                  line = to_str(line or "")
                                  if self.strip_color:
                                      # strip color codes
                      Severity: Minor
                      Found in localstack-core/localstack/utils/run.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

                      Function subscribe has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def subscribe(
                              self,
                              context: RequestContext,
                              topic_arn: topicARN,
                              protocol: String,
                      Severity: Minor
                      Found in localstack-core/localstack/services/sns/provider.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 resource_provider.py has 482 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      from __future__ import annotations
                      
                      import copy
                      import logging
                      import re

                        File api_utils.py has 481 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        """Utilities related to Lambda API operations such as ARN handling, validations, and output formatting.
                        Everything related to behavior or implicit functionality goes into `lambda_utils.py`.
                        """
                        
                        import datetime
                        Severity: Minor
                        Found in localstack-core/localstack/services/lambda_/api_utils.py - About 7 hrs to fix

                          KmsApi has 52 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class KmsApi:
                              service = "kms"
                              version = "2014-11-01"
                          
                              @handler("CancelKeyDeletion")
                          Severity: Major
                          Found in localstack-core/localstack/aws/api/kms/__init__.py - About 7 hrs to fix

                            EsApi has 51 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class EsApi:
                                service = "es"
                                version = "2015-01-01"
                            
                                @handler("AcceptInboundCrossClusterSearchConnection")
                            Severity: Major
                            Found in localstack-core/localstack/aws/api/es/__init__.py - About 7 hrs to fix

                              File __init__.py has 465 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              from datetime import datetime
                              from typing import List, Optional, TypedDict
                              
                              from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler
                              
                              
                              Severity: Minor
                              Found in localstack-core/localstack/aws/api/acm/__init__.py - About 7 hrs to fix

                                Function does_match_event has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                                Open

                                def does_match_event(event_pattern: dict[str, any], event: dict[str, any]) -> bool:
                                    """Decides whether an event pattern matches an event or not.
                                    Returns True if the `event_pattern` matches the given `event` and False otherwise.
                                
                                    Implements "Amazon EventBridge event patterns":

                                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 provider.py has 459 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import datetime
                                import json
                                import logging
                                import os
                                import re
                                Severity: Minor
                                Found in localstack-core/localstack/services/events/v1/provider.py - About 7 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language