localstack/localstack

View on GitHub

Showing 3,154 of 3,154 total issues

LogsApi has 74 functions (exceeds 20 allowed). Consider refactoring.
Open

class LogsApi:
    service = "logs"
    version = "2014-03-28"

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

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

    import base64
    import json
    import logging
    from datetime import datetime, timezone
    from typing import Optional
    Severity: Major
    Found in localstack/services/events/provider.py - About 1 day to fix

      Function matches_event has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

      def matches_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":
      Severity: Minor
      Found in localstack/services/events/v1/utils.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

      SesApi has 71 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SesApi:
          service = "ses"
          version = "2010-12-01"
      
          @handler("CloneReceiptRuleSet")
      Severity: Major
      Found in localstack/aws/api/ses/__init__.py - About 1 day to fix

        Route53Api has 70 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Route53Api:
            service = "route53"
            version = "2013-04-01"
        
            @handler("ActivateKeySigningKey")
        Severity: Major
        Found in localstack/aws/api/route53/__init__.py - About 1 day to fix

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

          from datetime import datetime
          from typing import Dict, List, Optional, TypedDict
          
          from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler
          
          
          Severity: Major
          Found in localstack/aws/api/secretsmanager/__init__.py - About 1 day to fix

            Function parse_additional_flags has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
            Open

                def parse_additional_flags(
                    additional_flags: str,
                    env_vars: Optional[Dict[str, str]] = None,
                    labels: Optional[Dict[str, str]] = None,
                    mounts: Optional[List[SimpleVolumeBind]] = None,
            Severity: Minor
            Found in localstack/utils/container_utils/container_client.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 _add_paths has a Cognitive Complexity of 65 (exceeds 5 allowed). Consider refactoring.
            Open

                def _add_paths(self, spec, resources, with_extension):
                    for item in resources.get("items"):
                        path = item.get("path")
                        for method, method_config in item.get("resourceMethods", {}).items():
                            method = method.lower()
            Severity: Minor
            Found in localstack/services/apigateway/exporter.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 provider.py has 591 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import logging
            import os
            import re
            import threading
            from datetime import datetime, timezone
            Severity: Major
            Found in localstack/services/opensearch/provider.py - About 1 day to fix

              Route53ResolverApi has 68 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Route53ResolverApi:
                  service = "route53resolver"
                  version = "2018-04-01"
              
                  @handler("AssociateFirewallRuleGroup")
              Severity: Major
              Found in localstack/aws/api/route53resolver/__init__.py - About 1 day to fix

                File testutil.py has 583 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import glob
                import importlib
                import io
                import json
                import os
                Severity: Major
                Found in localstack/utils/testutil.py - About 1 day to fix

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

                  import hashlib
                  import logging
                  from collections import defaultdict
                  from datetime import datetime
                  from secrets import token_urlsafe
                  Severity: Major
                  Found in localstack/services/s3/v3/models.py - About 1 day to fix

                    S3Provider has 67 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    class S3Provider(S3Api, ServiceLifecycleHook):
                        @staticmethod
                        def get_store(account_id: Optional[str] = None, region: Optional[str] = None) -> S3Store:
                            return s3_stores[account_id or DEFAULT_AWS_ACCOUNT_ID][region or AWS_REGION_US_EAST_1]
                    
                    
                    Severity: Major
                    Found in localstack/services/s3/provider.py - About 1 day to fix

                      Function _add_paths has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _add_paths(self, spec, resources, with_extension):
                              for item in resources.get("items"):
                                  path = item.get("path")
                                  for method, method_config in item.get("resourceMethods", {}).items():
                                      method = method.lower()
                      Severity: Minor
                      Found in localstack/services/apigateway/exporter.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

                      LambdaApi has 66 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class LambdaApi:
                          service = "lambda"
                          version = "2015-03-31"
                      
                          @handler("AddLayerVersionPermission")
                      Severity: Major
                      Found in localstack/aws/api/lambda_/__init__.py - About 1 day to fix

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

                        def run_server(
                            port: int,
                            bind_addresses: List[str],
                            handler: Callable = None,
                            asynchronous: bool = True,
                        Severity: Minor
                        Found in localstack/utils/server/http2_server.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 __init__.py has 554 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        from typing import Dict, List, Optional, TypedDict
                        
                        from localstack.aws.api import RequestContext, ServiceException, ServiceRequest, handler
                        
                        Boolean = bool
                        Severity: Major
                        Found in localstack/aws/api/sqs/__init__.py - About 1 day to fix

                          File cluster.py has 552 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import dataclasses
                          import logging
                          import os
                          import threading
                          from typing import Dict, List, NamedTuple, Optional, Tuple
                          Severity: Major
                          Found in localstack/services/opensearch/cluster.py - About 1 day to fix

                            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/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
                              Severity: Major
                              Found in localstack/services/s3/resource_providers/aws_s3_bucket.py - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language