Shoobx/shoobx.mocks3

View on GitHub

Showing 10 of 10 total issues

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

###############################################################################
#
# Copyright 2016-2022 by Shoobx, Inc.
#
###############################################################################
Severity: Major
Found in src/shoobx/mocks3/models.py - About 1 day to fix

    Key has 25 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Key(models.FakeKey):
        _last_modified = _InfoProperty("last_modified")
        storage_class = _InfoProperty("storage_class")
        metadata = _InfoProperty("metadata")
        _etag = _InfoProperty("etag")
    Severity: Minor
    Found in src/shoobx/mocks3/models.py - About 2 hrs to fix

      Function reset has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def reset(self):
              # For every key and multipart, Moto opens a TemporaryFile to write the value of
              # those keys. Ensure that these TemporaryFile-objects are closed, and leave no
              # filehandles open
              for bucket in self.buckets.values():
      Severity: Minor
      Found in src/shoobx/mocks3/models.py - About 1 hr 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 put_object has 14 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def put_object(
      Severity: Major
      Found in src/shoobx/mocks3/models.py - About 1 hr to fix

        Function __init__ has 13 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Major
        Found in src/shoobx/mocks3/models.py - About 1 hr to fix

          Function create_multipart_upload has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def create_multipart_upload(
          Severity: Major
          Found in src/shoobx/mocks3/models.py - About 1 hr to fix

            Function rules has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def rules(self):
                    if not os.path.exists(self._lifecyle_path):
                        return []
                    rules = []
                    with open(self._lifecyle_path) as file:
            Severity: Minor
            Found in src/shoobx/mocks3/models.py - About 55 mins 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 fill_config has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def fill_config(config_path):
                """
                Config priority
            
                default values -> config -> env
            Severity: Minor
            Found in src/shoobx/mocks3/config.py - About 55 mins 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

            Avoid deeply nested control flow statements.
            Open

                                    for part in key.multipart.parts.values():
                                        part._value_buffer.close()
                    super().reset()
            Severity: Major
            Found in src/shoobx/mocks3/models.py - About 45 mins to fix

              Function complete has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def complete(self, body):
                      decode_hex = codecs.getdecoder("hex_codec")
                      total = bytearray()
                      md5s = bytearray()
              
              
              Severity: Minor
              Found in src/shoobx/mocks3/models.py - About 35 mins 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