rbnvrw/nd2reader

View on GitHub
nd2reader/raw_metadata.py

Summary

Maintainability
D
1 day
Test Coverage

File raw_metadata.py has 477 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import re
import xmltodict
import six
import numpy as np
import warnings
Severity: Minor
Found in nd2reader/raw_metadata.py - About 7 hrs to fix

    RawMetadata has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class RawMetadata(object):
        """RawMetadata class parses and stores the raw metadata that is read from the binary file in dict format.
        """
    
        def __init__(self, fh, label_map):
    Severity: Minor
    Found in nd2reader/raw_metadata.py - About 6 hrs to fix

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

          def _parse_events(self):
              """Extract events
      
              """
      
      
      Severity: Minor
      Found in nd2reader/raw_metadata.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 _process_channels_metadata has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _process_channels_metadata(self, metadata):
              validity = self._get_channel_validity_list(metadata)
      
              # Channel information is contained in dictionaries with the keys a0, a1...an where the number
              # indicates the order in which the channel is stored. So by sorting the dicts alphabetically
      Severity: Minor
      Found in nd2reader/raw_metadata.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