odin-detector/odin-data

View on GitHub

Showing 69 of 110 total issues

File live_view_proxy_adapter.py has 264 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""ODIN data live view proxy adapter.

This module implements an odin-control adapter capable of subscribing to
multiple Odin Data Live View plugins and combining all streams of frames
into a single ZMQ stream.
Severity: Minor
Found in python/src/odin_data/control/live_view_proxy_adapter.py - About 2 hrs to fix

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

    def git_get_keywords(versionfile_abs):
        """Extract version information from the given file."""
        # the code embedded in _version.py can just fetch the value of these
        # keywords. When used from setup.py, we don't want to import _version.py,
        # so we do it with a regexp instead. This function is not used from
    Severity: Minor
    Found in python/src/odin_data/_version.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 git_pieces_from_vcs has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command):
        """Get version from 'git describe' in the root of the source tree.
    
        This only gets called if the git-archive 'subst' keywords were *not*
        expanded, and _version.py hasn't already been rewritten with a short
    Severity: Minor
    Found in python/src/odin_data/_version.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 git_versions_from_keywords has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def git_versions_from_keywords(keywords, tag_prefix, verbose):
        """Get version information from git keywords."""
        if not keywords:
            raise NotThisMethod("no keywords at all, weird")
        date = keywords.get("date")
    Severity: Minor
    Found in python/src/odin_data/_version.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 update_loop has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def update_loop(self):
            """Handle background update loop tasks.
            This method handles background update tasks executed periodically in the tornado
            IOLoop instance. This includes requesting the status from the underlying application
            and preparing the JSON encoded reply in a format that can be easily parsed.
    Severity: Minor
    Found in python/src/odin_data/control/odin_data_adapter.py - About 1 hr 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 configure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def configure(self, request):
            """Handle a configuration message
    
            Args:
                request(IpcMessage): The request message
    Severity: Minor
    Found in python/src/odin_data/meta_writer/meta_listener.py - About 1 hr 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

    Method refreshImage has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        private void refreshImage(ByteBuffer data, String dtype, int[] shape)
        {
            int bitdepth = dtype_map.get(dtype);
            ImageProcessor ip = img.getProcessor();
            Object img_pixels = null;
    Severity: Minor
    Found in tools/imagej/src/LiveViewSocket.java - About 1 hr 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_reconnection has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def process_reconnection(self, client):
            # We have been notified that a client has reconnected.
            # Loop over all stored configuration, sending any that needs to be processed
            logging.debug("Processing reconnection for client: %d", client)
            # First load the configuration file
    Severity: Minor
    Found in python/src/odin_data/control/odin_data_adapter.py - About 1 hr 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 handle_data_message has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def handle_data_message(self, socket, endpoint):
            """Handle a data message on the given socket
    
            Args:
                socket(zmq.Socket): The socket to receive a message on
    Severity: Minor
    Found in python/src/odin_data/meta_writer/meta_listener.py - About 1 hr 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 _send_message has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _send_message(self, msg, timeout):
            msg.set_msg_id(self.message_id)
            self.message_id = (self.message_id + 1) % self.MESSAGE_ID_MAX
            self.logger.debug("Sending control message:\n%s", msg.encode())
            with self._lock:
    Severity: Minor
    Found in python/src/odin_data/control/ipc_client.py - About 1 hr 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 __del__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def __del__(self):
    
            for mapped_ctype_name in ('manager_id', 'num_buffers', 'buffer_size'):
                mapped_ctype = getattr(self, mapped_ctype_name, None)
                if mapped_ctype is not None:
    Severity: Minor
    Found in python/src/odin_data/shared_buffer_manager.py - About 1 hr 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 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 process_configuration_file has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def process_configuration_file(self, config_file_path, client_index):
              status_code = 200
              response = {}
              if config_file_path != '':
                  logging.debug("Loading configuration file {}".format(config_file_path))
      Severity: Minor
      Found in python/src/odin_data/control/odin_data_adapter.py - About 1 hr 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 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 process_configuration has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def process_configuration(self, request_command, parameters):
                  status_code = 200
                  response = {}
                  logging.debug("Process configuration with URI: %s", request_command)
                  client_index = -1
          Severity: Minor
          Found in python/src/odin_data/control/odin_data_adapter.py - About 1 hr 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 render_pep440 has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          def render_pep440(pieces):
              """Build up version string, with post-release "local version identifier".
          
              Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
              get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
          Severity: Minor
          Found in python/src/odin_data/_version.py - About 1 hr 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

          Method update has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void update(Observable o, Object arg)
              {
                  switch(arg.toString().toLowerCase())
                  {
          Severity: Minor
          Found in tools/imagej/src/Live_View.java - 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 render_pep440_post has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

              def render_pep440_post(pieces):
                  """TAG[.postDISTANCE[.dev0]+gHEX] .
              
                  The ".dev0" means dirty. Note that .dev0 sorts backwards
                  (a dirty tree will appear "older" than the corresponding clean one),
              Severity: Minor
              Found in python/src/odin_data/_version.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

              Severity
              Category
              Status
              Source
              Language