odin-detector/odin-data

View on GitHub

Showing 69 of 110 total issues

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

    def __init__(self, shared_mem_name, shared_mem_size=0, buffer_size=0,
Severity: Minor
Found in python/src/odin_data/shared_buffer_manager.py - About 35 mins to fix

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

        def _create_datasets(self, dataset_size):
            """Add predefined datasets to HDF5 file and store handles
    
            Args:
                datasets(list(HDF5Dataset)): The datasets to add to the file
    Severity: Minor
    Found in python/src/odin_data/meta_writer/meta_writer.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 __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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, endpoints, default_colormap):
            """
            Initialise the LiveViewer object.
    
            This method creates the IPC channel used to receive images from odin-data and
    Severity: Minor
    Found in python/src/odin_data/control/live_view_adapter.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

    Avoid too many return statements within this function.
    Open

        return {"version": "0+unknown", "full-revisionid": None,
    Severity: Major
    Found in python/src/odin_data/_version.py - About 30 mins to fix

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

          def __init__(self, msg_type=None, msg_val=None, from_str=None, id=None):
              self.attrs = {}
      
              if from_str is None:
                  self.attrs['id'] = id
      Severity: Minor
      Found in python/src/odin_data/control/ipc_message.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 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

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

      def get_versions(ref: str, add: Optional[str], remove: Optional[str]) -> List[str]:
          """Generate the file containing the list of all GitHub Pages builds."""
          # Get the directories (i.e. builds) from the GitHub Pages branch
          try:
              builds = set(get_branch_contents(ref))
      Severity: Minor
      Found in .github/pages/make_switcher.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 get_versions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_versions():
          """Get version information or return default if unable to do so."""
          # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
          # __file__, we can work backwards from there to the root. Some
          # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
      Severity: Minor
      Found in python/src/odin_data/_version.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

      Severity
      Category
      Status
      Source
      Language