localstack/localstack

View on GitHub

Showing 3,140 of 3,140 total issues

File __init__.py has 1145 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/cloudwatch/__init__.py - About 2 days to fix

    File container_client.py has 1123 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import dataclasses
    import io
    import ipaddress
    import logging
    import os
    Severity: Major
    Found in localstack/utils/container_utils/container_client.py - About 2 days to fix

      SsmApi has 139 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class SsmApi:
          service = "ssm"
          version = "2014-11-06"
      
          @handler("AddTagsToResource")
      Severity: Major
      Found in localstack/aws/api/ssm/__init__.py - About 2 days to fix

        File __init__.py has 1048 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/firehose/__init__.py - About 2 days to fix

          RedshiftApi has 133 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class RedshiftApi:
              service = "redshift"
              version = "2012-12-01"
          
              @handler("AcceptReservedNodeExchange")
          Severity: Major
          Found in localstack/aws/api/redshift/__init__.py - About 2 days to fix

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

            import json
            import logging
            import re
            from collections import defaultdict
            from copy import deepcopy
            Severity: Major
            Found in localstack/services/cloudformation/provider.py - About 2 days to fix

              Keyword_or_stringContext has 130 functions (exceeds 20 allowed). Consider refactoring.
              Open

                  class Keyword_or_stringContext(ParserRuleContext):
                      __slots__ = 'parser'
              
                      def __init__(self, parser, parent:ParserRuleContext=None, invokingState:int=-1):
                          super().__init__(parent, invokingState)
              Severity: Major
              Found in localstack/services/stepfunctions/asl/antlr/runtime/ASLParser.py - About 2 days to fix

                File bootstrap.py has 1000 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from __future__ import annotations
                
                import copy
                import functools
                import logging
                Severity: Major
                Found in localstack/utils/bootstrap.py - About 2 days to fix

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

                  import hashlib
                  import heapq
                  import inspect
                  import json
                  import logging
                  Severity: Major
                  Found in localstack/services/sqs/models.py - About 2 days to fix

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

                    import logging
                    import os
                    import platform
                    import socket
                    import subprocess
                    Severity: Major
                    Found in localstack/config.py - About 2 days to fix

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

                      import json
                      import logging
                      from typing import Dict, List
                      
                      from botocore.utils import InvalidArnException
                      Severity: Major
                      Found in localstack/services/sns/provider.py - About 2 days to fix

                        ApigatewayApi has 120 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class ApigatewayApi:
                            service = "apigateway"
                            version = "2015-07-09"
                        
                            @handler("CreateApiKey")
                        Severity: Major
                        Found in localstack/aws/api/apigateway/__init__.py - About 2 days to fix

                          File parser.py has 909 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          """
                          Request parsers for the different AWS service protocols.
                          
                          The module contains classes that take an HTTP request to a service, and
                          given an operation model, parse the HTTP request according to the
                          Severity: Major
                          Found in localstack/aws/protocol/parser.py - About 2 days to fix

                            File integration.py has 876 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import base64
                            import json
                            import logging
                            import re
                            from abc import ABC, abstractmethod
                            Severity: Major
                            Found in localstack/services/apigateway/integration.py - About 2 days to fix

                              ASLParserVisitor has 103 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class ASLParserVisitor(ParseTreeVisitor):
                              
                                  # Visit a parse tree produced by ASLParser#state_machine.
                                  def visitState_machine(self, ctx:ASLParser.State_machineContext):
                                      return self.visitChildren(ctx)

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

                                import copy
                                import datetime
                                import json
                                import logging
                                import re
                                Severity: Major
                                Found in localstack/services/stepfunctions/provider.py - About 1 day to fix

                                  File utils.py has 806 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  import base64
                                  import codecs
                                  import datetime
                                  import hashlib
                                  import logging
                                  Severity: Major
                                  Found in localstack/services/s3/utils.py - About 1 day to fix

                                    S3Api has 100 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class S3Api:
                                        service = "s3"
                                        version = "2006-03-01"
                                    
                                        @handler("AbortMultipartUpload")
                                    Severity: Major
                                    Found in localstack/aws/api/s3/__init__.py - About 1 day to fix

                                      File provider_v2.py has 796 lines of code (exceeds 250 allowed). Consider refactoring.
                                      Open

                                      import datetime
                                      import json
                                      import logging
                                      import threading
                                      import uuid
                                      Severity: Major
                                      Found in localstack/services/cloudwatch/provider_v2.py - About 1 day to fix

                                        Function _resolve_refs_recursively has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                        def _resolve_refs_recursively(
                                            account_id: str,
                                            region_name: str,
                                            stack_name: str,
                                            resources: dict,
                                        Severity: Minor
                                        Found in localstack/services/cloudformation/engine/template_deployer.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

                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language