localstack/localstack

View on GitHub

Showing 3,157 of 3,157 total issues

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

File docker_sdk_client.py has 787 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
import json
import logging
import os
import queue
Severity: Major
Found in localstack/utils/container_utils/docker_sdk_client.py - About 1 day to fix

    File preprocessor.py has 786 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    from typing import Optional
    
    from antlr4 import ParserRuleContext
    from antlr4.tree.Tree import ParseTree, TerminalNodeImpl
    Severity: Major
    Found in localstack/services/stepfunctions/asl/parse/preprocessor.py - About 1 day to fix

      File __init__.py has 764 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/sns/__init__.py - About 1 day to fix

        ASLParser has 94 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class ASLParser ( Parser ):
        
            grammarFileName = "ASLParser.g4"
        
            atn = ATNDeserializer().deserialize(serializedATN())
        Severity: Major
        Found in localstack/services/stepfunctions/asl/antlr/runtime/ASLParser.py - About 1 day to fix

          File docker_cmd_client.py has 763 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import functools
          import itertools
          import json
          import logging
          import os
          Severity: Major
          Found in localstack/utils/container_utils/docker_cmd_client.py - About 1 day to fix

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

            from datetime import datetime, timezone
            
            from moto.route53resolver.models import Route53ResolverBackend as MotoRoute53ResolverBackend
            from moto.route53resolver.models import route53resolver_backends
            
            
            Severity: Major
            Found in localstack/services/route53resolver/provider.py - About 1 day to fix

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

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

                S3ControlApi has 92 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class S3ControlApi:
                    service = "s3control"
                    version = "2018-08-20"
                
                    @handler("AssociateAccessGrantsIdentityCenter")
                Severity: Major
                Found in localstack/aws/api/s3control/__init__.py - About 1 day to fix

                  ConfigApi has 92 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ConfigApi:
                      service = "config"
                      version = "2014-11-12"
                  
                      @handler("BatchGetAggregateResourceConfig")
                  Severity: Major
                  Found in localstack/aws/api/config/__init__.py - About 1 day to fix

                    File server.py has 746 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import argparse
                    import copy
                    import logging
                    import os
                    import re
                    Severity: Major
                    Found in localstack/dns/server.py - About 1 day to fix

                      File notifications.py has 720 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      from __future__ import annotations
                      
                      import datetime
                      import json
                      import logging
                      Severity: Major
                      Found in localstack/services/s3/notifications.py - About 1 day to fix

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

                        from __future__ import annotations
                        
                        import json
                        import logging
                        import re
                        Severity: Major
                        Found in localstack/services/secretsmanager/provider.py - About 1 day to fix

                          File localstack.py has 709 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import json
                          import logging
                          import os
                          import sys
                          import traceback
                          Severity: Major
                          Found in localstack/cli/localstack.py - About 1 day to fix

                            File transformer_utility.py has 708 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import json
                            import logging
                            import re
                            from datetime import datetime
                            from json import JSONDecodeError
                            Severity: Major
                            Found in localstack/testing/snapshots/transformer_utility.py - About 1 day to fix

                              File presigned_url.py has 682 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import base64
                              import copy
                              import datetime
                              import json
                              import logging
                              Severity: Major
                              Found in localstack/services/s3/presigned_url.py - About 1 day to fix

                                CloudformationApi has 82 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class CloudformationApi:
                                    service = "cloudformation"
                                    version = "2010-05-15"
                                
                                    @handler("ActivateOrganizationsAccess")
                                Severity: Major
                                Found in localstack/aws/api/cloudformation/__init__.py - About 1 day to fix

                                  File __main__.py has 661 lines of code (exceeds 250 allowed). Consider refactoring.
                                  Open

                                  from __future__ import annotations
                                  
                                  import json
                                  import os
                                  import zipfile
                                  Severity: Major
                                  Found in localstack/services/cloudformation/scaffolding/__main__.py - About 1 day to fix

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

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

                                      Function resolve_dependencies has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring.
                                      Open

                                      def resolve_dependencies(d: dict, evaluated_conditions: dict[str, bool]) -> set[str]:
                                          items = set()
                                      
                                          if isinstance(d, dict):
                                              for k, v in d.items():
                                      Severity: Minor
                                      Found in localstack/services/cloudformation/engine/template_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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language