odin-detector/odin-data

View on GitHub

Showing 110 of 110 total issues

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

class IpcMessageException(Exception):
    def __init__(self, msg, errno=None):
        self.msg = msg
        self.errno = errno

Severity: Major
Found in python/src/odin_data/control/ipc_message.py and 1 other location - About 1 hr to fix
python/src/odin_data/shared_buffer_manager.py on lines 8..15

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

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 5 locations. Consider refactoring.
Open

                    try:
                        client.send_configuration(parameters, command)
                    except Exception as err:
                        logging.debug(OdinDataAdapter.ERROR_FAILED_TO_SEND)
                        logging.error("Error: %s", err)
Severity: Major
Found in python/src/odin_data/control/odin_data_adapter.py and 4 other locations - About 1 hr to fix
python/src/odin_data/control/meta_listener_adapter.py on lines 153..159
python/src/odin_data/control/odin_data_adapter.py on lines 397..409
python/src/odin_data/control/odin_data_adapter.py on lines 432..440
python/src/odin_data/control/odin_data_adapter.py on lines 457..464

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

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 __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

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

                except IOError as io_error:
                    logging.error("Failed to open configuration file: {}".format(io_error))
                    status_code = 503
                    response = {'error': "Failed to open configuration file: {}".format(io_error)}
    Severity: Major
    Found in python/src/odin_data/control/odin_data_adapter.py and 1 other location - About 1 hr to fix
    python/src/odin_data/control/odin_data_adapter.py on lines 327..330

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

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

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

                except ValueError as value_error:
                    logging.error("Failed to parse json config: {}".format(value_error))
                    status_code = 503
                    response = {'error': "Failed to parse json config: {}".format(value_error)}
    Severity: Major
    Found in python/src/odin_data/control/odin_data_adapter.py and 1 other location - About 1 hr to fix
    python/src/odin_data/control/odin_data_adapter.py on lines 323..326

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

    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 __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

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

              def handle_close_file(self, _header, data):
                  self._logger.debug("%s | Handling close file message", self._name)
          
                  self._add_value(CLOSE_DURATION, data[CLOSE_DURATION])
          Severity: Major
          Found in python/src/odin_data/meta_writer/meta_writer.py and 1 other location - About 1 hr to fix
          python/src/odin_data/meta_writer/meta_writer.py on lines 499..502

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

          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 __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

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

                def handle_create_file(self, _header, data):
                    self._logger.debug("%s | Handling create file message", self._name)
            
                    self._add_value(CREATE_DURATION, data[CREATE_DURATION])
            Severity: Major
            Found in python/src/odin_data/meta_writer/meta_writer.py and 1 other location - About 1 hr to fix
            python/src/odin_data/meta_writer/meta_writer.py on lines 558..561

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

            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_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

            Method run_socket has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                private void run_socket()
                {
                    while(!Thread.currentThread().isInterrupted())
                    {
                        if(!is_paused)
            Severity: Minor
            Found in tools/imagej/src/LiveViewSocket.java - 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 render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def render(pieces, style):
                """Render the given version pieces into the requested style."""
                if pieces["error"]:
                    return {"version": "unknown",
                            "full-revisionid": pieces.get("long"),
            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

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

                def process_updates(self):
                    """Handle additional background update loop tasks
            
                    Store a copy of all parameters so they don't disappear
            
            
            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 render_pep440_old has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

            def render_pep440_old(pieces):
                """TAG[.postDISTANCE[.dev0]] .
            
                The ".dev0" means dirty.
            
            
            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

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

                def __init__(self, **kwargs):
                    """
                    Initialise the Adapter, using the provided configuration.
                    Create the node classes for the subscriptions to multiple ZMQ sockets.
                    Also create the publish socket to push frames onto.
            Severity: Minor
            Found in python/src/odin_data/control/live_view_proxy_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

            Severity
            Category
            Status
            Source
            Language