rbnvrw/nd2reader

View on GitHub

Showing 13 of 14 total issues

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

      LabelMap has 27 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class LabelMap(object):
          """Contains pointers to metadata. This might only be valid for V3 files.
      
          """
      
      
      Severity: Minor
      Found in nd2reader/label_map.py - About 3 hrs to fix

        Function get_loops_from_data has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

        def get_loops_from_data(loop_data):
            # special ND experiment
            if six.b('pPeriod') not in loop_data:
                return []
        
        
        Severity: Minor
        Found in nd2reader/common_raw_metadata.py - About 2 hrs 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 determine_sampling_interval has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def determine_sampling_interval(duration, loop):
            """Determines the loop sampling interval in milliseconds
        
            Args:
                duration: loop duration in milliseconds
        Severity: Minor
        Found in nd2reader/common_raw_metadata.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 get_image_by_attributes has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_image_by_attributes(self, frame_number, field_of_view, channel, z_level, height, width):
        Severity: Minor
        Found in nd2reader/parser.py - About 45 mins to fix

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

              def select(self, fields_of_view=None, channels=None, z_levels=None, start=0, stop=None):
          Severity: Minor
          Found in nd2reader/legacy.py - About 35 mins to fix

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

            def parse_dimension_text_line(line):
                if six.b("Dimensions:") in line:
                    entries = line.split(six.b("\r\n"))
                    for entry in entries:
                        if entry.startswith(six.b("Dimensions:")):
            Severity: Minor
            Found in nd2reader/common_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 get_image_by_attributes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_image_by_attributes(self, frame_number, field_of_view, channel, z_level, height, width):
                    """Gets an image based on its attributes alone
            
                    Args:
                        frame_number: the frame number
            Severity: Minor
            Found in nd2reader/parser.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 _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 parse_date has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def parse_date(text_info):
                """
                The date and time when acquisition began.
            
                Args:
            Severity: Minor
            Found in nd2reader/common.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

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

                def get_image_data_location(self, index):
                    """Get the location of the image data
            
                    Returns:
                        int: The location of the image data
            Severity: Minor
            Found in nd2reader/label_map.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