odin-detector/odin-data

View on GitHub

Showing 110 of 110 total issues

File LiveViewSocket.java has 293 lines of code (exceeds 250 allowed). Consider refactoring.
Open

 import java.nio.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Observable;

Severity: Minor
Found in tools/imagej/src/LiveViewSocket.java - About 3 hrs to fix

    Method refreshImage has 71 lines of code (exceeds 25 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: Major
    Found in tools/imagej/src/LiveViewSocket.java - About 2 hrs to fix

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def cast_unicode(s, encoding="utf8", errors="strict"):
          """Cast bytes or unicode to unicode
      
          :param s: string to cast
          :param encoding: encoding to use
      Severity: Major
      Found in python/src/odin_data/util.py and 1 other location - About 2 hrs to fix
      python/src/odin_data/util.py on lines 20..37

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def cast_bytes(s, encoding="utf8", errors="strict"):
          """Cast unicode or bytes to bytes
      
          :param obj: the dictionary, list, or unicode string
          :param encoding: encoding to use
      Severity: Major
      Found in python/src/odin_data/util.py and 1 other location - About 2 hrs to fix
      python/src/odin_data/util.py on lines 40..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def do_status_cmd(self):
              """Send a status command to odin-data."""
              status_msg = IpcMessage('cmd', 'status', id=self._next_msg_id())
              self.logger.info("Sending status request to the odin-data application")
              self.ctrl_channel.send(status_msg.encode())
      Severity: Major
      Found in python/src/odin_data/client.py and 2 other locations - About 2 hrs to fix
      python/src/odin_data/client.py on lines 127..132
      python/src/odin_data/client.py on lines 134..139

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def do_shutdown_cmd(self):
              """Send a shutdown command to odin-data."""
              shutdown_msg = IpcMessage('cmd', 'shutdown', id=self._next_msg_id())
              self.logger.info("Sending shutdown command to the odin-data application")
              self.ctrl_channel.send(shutdown_msg.encode())
      Severity: Major
      Found in python/src/odin_data/client.py and 2 other locations - About 2 hrs to fix
      python/src/odin_data/client.py on lines 120..125
      python/src/odin_data/client.py on lines 127..132

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          def do_request_config_cmd(self):
              """Send a request configurtion command to odin-data."""
              status_msg = IpcMessage('cmd', 'request_configuration', id=self._next_msg_id())
              self.logger.info("Sending configuration request to the odin-data application")
              self.ctrl_channel.send(status_msg.encode())
      Severity: Major
      Found in python/src/odin_data/client.py and 2 other locations - About 2 hrs to fix
      python/src/odin_data/client.py on lines 120..125
      python/src/odin_data/client.py on lines 134..139

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 60.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def stop_when_detector_finished(self):
              """Register that it is OK to stop when all detector-specific logic is complete
      
              By default, detector_finished is set to True initially so that this check always
              passes. Child classes that need to do their own checks can set this to False in
      Severity: Major
      Found in python/src/odin_data/meta_writer/meta_writer.py and 1 other location - About 2 hrs to fix
      python/src/odin_data/meta_writer/meta_writer.py on lines 356..367

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          def stop_when_writers_finished(self):
              """Register that it is OK to stop when all monitored writers have finished
      
              Child classes can call this when all detector-specific logic is complete.
      
      
      Severity: Major
      Found in python/src/odin_data/meta_writer/meta_writer.py and 1 other location - About 2 hrs to fix
      python/src/odin_data/meta_writer/meta_writer.py on lines 341..354

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 58.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function run has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self):
              """Main application loop"""
              context = zmq.Context()
              ctrl_endpoint = "tcp://*:{}".format(self._ctrl_port)
              self._logger.info("Binding control address to %s", ctrl_endpoint)
      Severity: Minor
      Found in python/src/odin_data/meta_writer/meta_listener.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 run_command has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

      def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
                      env=None):
          """Call the given command(s)."""
          assert isinstance(commands, list)
          p = None
      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

      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

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            @staticmethod
            def _raise_reply_error(msg, reply):
                if reply is not None:
                    raise IpcMessageException(
                        "Request\n%s\nunsuccessful."
        Severity: Major
        Found in python/src/odin_data/control/ipc_client.py and 1 other location - About 1 hr to fix
        python/src/odin_data/control/ipc_tornado_client.py on lines 80..85

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 49.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

            @staticmethod
            def _raise_reply_error(msg, reply):
                if reply is not None:
                    raise IpcMessageException("Request\n%s\nunsuccessful. Got invalid response: %s" % (msg, reply))
                else:
        Severity: Major
        Found in python/src/odin_data/control/ipc_tornado_client.py and 1 other location - About 1 hr to fix
        python/src/odin_data/control/ipc_client.py on lines 59..67

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 49.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if msg['event'] == IpcTornadoChannel.DISCONNECTED:
                    self.logger.debug("  Disconnected...")
                    self._parameters['status']['connected'] = False
        Severity: Major
        Found in python/src/odin_data/control/ipc_tornado_client.py and 1 other location - About 1 hr to fix
        python/src/odin_data/control/ipc_tornado_client.py on lines 38..40

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if msg['event'] == IpcTornadoChannel.CONNECTED:
                    self.logger.debug("  Connected...")
                    self._parameters['status']['connected'] = True
        Severity: Major
        Found in python/src/odin_data/control/ipc_tornado_client.py and 1 other location - About 1 hr to fix
        python/src/odin_data/control/ipc_tornado_client.py on lines 41..43

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 48.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                if path in self._param:
                    response['value'] = self._param[path]
                else:
                    return super(FrameProcessorAdapter, self).get(path, request)
        Severity: Major
        Found in python/src/odin_data/control/frame_processor_adapter.py and 1 other location - About 1 hr to fix
        python/src/odin_data/control/meta_listener_adapter.py on lines 85..90

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Severity
        Category
        Status
        Source
        Language