zincware/MDSuite

View on GitHub
mdsuite/utils/meta_functions.py

Summary

Maintainability
C
1 day
Test Coverage

File meta_functions.py has 433 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""
MDSuite: A Zincwarecode package.

License
-------
Severity: Minor
Found in mdsuite/utils/meta_functions.py - About 6 hrs to fix

    Function get_dimensionality has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_dimensionality(box: list) -> int:
        """
        Calculate the dimensionality of the experiment box.
    
        Parameters
    Severity: Minor
    Found in mdsuite/utils/meta_functions.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 golden_section_search has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def golden_section_search(
    Severity: Major
    Found in mdsuite/utils/meta_functions.py - About 1 hr to fix

      Function golden_section_search has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def golden_section_search(
          data: np.array,
          a: float,
          b: float,
          tol: float = 1e-5,
      Severity: Minor
      Found in mdsuite/utils/meta_functions.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 find_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def find_item(obj, key):
          """
          Function to recursively retrieve values given a key for nested dictionaries.
      
          Parameters
      Severity: Minor
      Found in mdsuite/utils/meta_functions.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

      Consider simplifying this complex logical expression.
      Open

              if (
                  box[0] == 0
                  and box[1] == 0
                  or box[0] == 0
                  and box[2] == 0
      Severity: Major
      Found in mdsuite/utils/meta_functions.py - About 40 mins to fix

        Function optimize_batch_size has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def optimize_batch_size(
        Severity: Minor
        Found in mdsuite/utils/meta_functions.py - About 35 mins to fix

          There are no issues that match your filters.

          Category
          Status