odin-detector/odin-data

View on GitHub

Showing 110 of 110 total issues

Function get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, path, request):

        """Implementation of the HTTP GET verb for MetaListenerAdapter

        :param path: URI path of the GET request
Severity: Minor
Found in python/src/odin_data/control/meta_listener_adapter.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

Function put has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def put(self, path, request):

        """
        Implementation of the HTTP PUT verb for MetaListenerAdapter

Severity: Minor
Found in python/src/odin_data/control/meta_listener_adapter.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

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

    def __init__(
Severity: Major
Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 50 mins to fix

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

        def __init__(
    Severity: Major
    Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 50 mins to fix

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

          def bind(self, endpoint=None):
              """Bind the IpcChannel to an endpoint.
      
              :param: endpoint: endpoint URI to use, otherwise use initialised value
              """
      Severity: Minor
      Found in python/src/odin_data/control/ipc_channel.py and 1 other location - About 50 mins to fix
      python/src/odin_data/control/ipc_channel.py on lines 95..103

      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 36.

      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 connect(self, endpoint=None):
              """Connect the IpcChannel to an endpoint.
      
              :param: endpoint: endpoint URI to use, otherwise use initialised value
              """
      Severity: Minor
      Found in python/src/odin_data/control/ipc_channel.py and 1 other location - About 50 mins to fix
      python/src/odin_data/control/ipc_channel.py on lines 85..93

      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 36.

      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 render_image has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def render_image(self, colormap=None, clip_min=None, clip_max=None):
              """
              Render an image from the image data, applying a colormap to the greyscale data.
      
              :param colormap: Desired image colormap. if None, uses the default colormap.
      Severity: Minor
      Found in python/src/odin_data/control/live_view_adapter.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 clear_writers has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def clear_writers(self):
              unfinished_writers = {}
              for writer_name, writer in self._writers.items():
                  self._status_dict[writer_name] = writer.status()
                  if writer.finished:
      Severity: Minor
      Found in python/src/odin_data/meta_writer/meta_listener.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 uri_params_to_dictionary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def uri_params_to_dictionary(request_command, parameters):
              # Check to see if the request contains more than one item
              if request_command is not None:
                  request_list = request_command.split('/')
                  logging.debug("URI request list: %s", request_list)
      Severity: Minor
      Found in python/src/odin_data/control/odin_data_adapter.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 run_command has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False,
      Severity: Minor
      Found in python/src/odin_data/_version.py - About 45 mins to fix

        Function setup_logging has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        def setup_logging(default_log_config=None,
                          default_level=logging.INFO,
                          env_key='LOG_CFG'):
            """Setup logging configuration
        
        
        Severity: Minor
        Found in python/src/odin_data/meta_writer/logconfig.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, name, dtype, fillvalue, block_size, data_shape, block_timeout):
        Severity: Minor
        Found in python/src/odin_data/meta_writer/hdf5dataset.py - About 45 mins to fix

          Function add_value has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def add_value(self, value, offset=None):
                  """Add a value at the given offset
          
                  If we are caching parameters, add the value to the cache, otherwise
                  extend the dataset and write it directly.
          Severity: Minor
          Found in python/src/odin_data/meta_writer/hdf5dataset.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

          Avoid deeply nested control flow statements.
          Open

                                  for item in decoder_config:
                                      self._decoder_config[index][item] = decoder_config[item]
                      else:
          Severity: Major
          Found in python/src/odin_data/control/frame_receiver_adapter.py - About 45 mins to fix

            Function send_configuration has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def send_configuration(self, content, target=None, valid_error=None, timeout=1000):
                    msg = IpcMessage("cmd", "configure")
            
                    if target is not None:
                        msg.set_param(target, content)
            Severity: Minor
            Found in python/src/odin_data/control/ipc_client.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

            Method addComponent has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                private void addComponent(Component item, Panel panel, int x, int y, GridBagConstraints c)
            Severity: Minor
            Found in tools/imagej/src/Live_View.java - About 35 mins to fix

              Method addComponent has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  private void addComponent(Component comp, Component label, Panel panel, int x, GridBagConstraints constraints)
              Severity: Minor
              Found in tools/imagej/src/Live_View.java - About 35 mins to fix

                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

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

                          try:
                              param_value = self.attrs['params'][param_name]
                          except KeyError:
                              if default_value is None:
                                  raise IpcMessageException("Missing parameter " + param_name)
                  Severity: Minor
                  Found in python/src/odin_data/control/ipc_message.py and 1 other location - About 35 mins to fix
                  python/src/odin_data/control/ipc_message.py on lines 119..125

                  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 33.

                  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

                          try:
                              attr_value = self.attrs[attr_name]
                          except KeyError:
                              if default_value is None:
                                  raise IpcMessageException("Missing attribute " + attr_name)
                  Severity: Minor
                  Found in python/src/odin_data/control/ipc_message.py and 1 other location - About 35 mins to fix
                  python/src/odin_data/control/ipc_message.py on lines 70..76

                  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 33.

                  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