odin-detector/odin-data

View on GitHub
python/src/odin_data/meta_writer/hdf5dataset.py

Summary

Maintainability
D
1 day
Test Coverage

File hdf5dataset.py has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
from time import time
from typing import Optional

import h5py as h5
Severity: Minor
Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 5 hrs to fix

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

        def __init__(
    Severity: Major
    Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 1 hr to fix

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

          def __init__(
      Severity: Major
      Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 1 hr to fix

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

            def __init__(
        Severity: Major
        Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 1 hr to fix

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

                def __init__(
            Severity: Major
            Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 50 mins to fix

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

                  def __init__(
              Severity: Major
              Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 50 mins to fix

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

                    def __init__(self, name, dtype, fillvalue, block_size, data_shape, block_timeout):
                Severity: Minor
                Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 45 mins to fix

                  Function add_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def add_value(self, value, offset=None):
                          """Add a value at the given offset
                  
                          If we are caching parameters, add the value to the cache, otherwise
                          extend the dataset and write it directly.
                  Severity: Minor
                  Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 45 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(
                          self,
                          name,
                          dtype,
                          fillvalue,
                  Severity: Minor
                  Found in python/src/odin_data/meta_writer/hdf5dataset.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

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

                      def purge_blocks(self):
                          # Store to mark blocks for deletion
                          purged_blocks = []
                          # Iterate over a list copy as we may delete blocks
                          for block_index, block in list(self._blocks.items()):
                  Severity: Minor
                  Found in python/src/odin_data/meta_writer/hdf5dataset.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