scottwernervt/cloudstorage

View on GitHub
src/cloudstorage/drivers/minio.py

Summary

Maintainability
D
1 day
Test Coverage

File minio.py has 439 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Minio Driver."""
import logging
import re
from datetime import datetime, timedelta
from typing import Dict, Iterable, List  # noqa: F401
Severity: Minor
Found in src/cloudstorage/drivers/minio.py - About 6 hrs to fix

    MinioDriver has 26 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class MinioDriver(Driver):
        """Driver for interacting with any Minio compatible object storage
        server.
    
        .. code-block:: python
    Severity: Minor
    Found in src/cloudstorage/drivers/minio.py - About 3 hrs to fix

      Function upload_blob has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def upload_blob(
      Severity: Major
      Found in src/cloudstorage/drivers/minio.py - About 1 hr to fix

        Function generate_container_upload_url has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def generate_container_upload_url(
        Severity: Major
        Found in src/cloudstorage/drivers/minio.py - About 1 hr to fix

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

              def upload_blob(
                  self,
                  container: Container,
                  filename: FileLike,
                  blob_name: str = None,
          Severity: Minor
          Found in src/cloudstorage/drivers/minio.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 generate_blob_download_url has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def generate_blob_download_url(
          Severity: Minor
          Found in src/cloudstorage/drivers/minio.py - About 35 mins to fix

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

                def __init__(
            Severity: Minor
            Found in src/cloudstorage/drivers/minio.py - About 35 mins to fix

              Function download_blob has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def download_blob(self, blob: Blob, destination: FileLike) -> None:
                      data = self.client.get_object(blob.container.name, blob.name)
              
                      if isinstance(destination, str):
                          with open(destination, "wb") as blob_data:
              Severity: Minor
              Found in src/cloudstorage/drivers/minio.py - About 25 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 generate_container_upload_url has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def generate_container_upload_url(
                      self,
                      container: Container,
                      blob_name: str,
                      expires: int = 3600,
              Severity: Minor
              Found in src/cloudstorage/drivers/minio.py - About 25 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

              There are no issues that match your filters.

              Category
              Status