zincware/MDSuite

View on GitHub
mdsuite/database/simulation_database.py

Summary

Maintainability
D
1 day
Test Coverage

File simulation_database.py has 572 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
MDSuite: A Zincwarecode package.

License
-------
Severity: Major
Found in mdsuite/database/simulation_database.py - About 1 day to fix

    Function add_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def add_data(self, chunk: TrajectoryChunkData):
            """
            Add new data to the dataset.
    
            Parameters
    Severity: Minor
    Found in mdsuite/database/simulation_database.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 resize_datasets has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def resize_datasets(self, structure: dict):
            """
            Resize a dataset so more tensor_values can be added.
    
            Parameters
    Severity: Minor
    Found in mdsuite/database/simulation_database.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

                            if workaround_time_in_axis_1:
                                database[dataset_name][:, start_index:stop_index, :] = (
                                    np.swapaxes(write_data, 0, 1)
                                )
                            else:
    Severity: Major
    Found in mdsuite/database/simulation_database.py - About 45 mins to fix

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

          def add_dataset(self, architecture: dict):
              """
              Add a dataset of the necessary size to the database_path.
      
              Just as a separate method exists for building the group structure of the hdf5
      Severity: Minor
      Found in mdsuite/database/simulation_database.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 load_data has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def load_data(
      Severity: Minor
      Found in mdsuite/database/simulation_database.py - About 35 mins to fix

        Function load_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def load_data(
                self,
                path_list: list = None,
                select_slice: np.s_ = np.s_[:],
                dictionary: bool = False,
        Severity: Minor
        Found in mdsuite/database/simulation_database.py - About 35 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 _build_path_input has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def _build_path_input(structure: dict) -> dict:
                """
                Build an input to a hdf5 database_path from a dictionary.
        
                In many cases, whilst a dict can be passed on to a method, it is not ideal for
        Severity: Minor
        Found in mdsuite/database/simulation_database.py - About 35 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

        There are no issues that match your filters.

        Category
        Status