choderalab/yank

View on GitHub
Yank/analyze.py

Summary

Maintainability
F
4 days
Test Coverage

File analyze.py has 934 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/local/bin/env python

# ==============================================================================
# MODULE DOCSTRING
# ==============================================================================
Severity: Major
Found in Yank/analyze.py - About 2 days to fix

    Function extract_trajectory has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    def extract_trajectory(nc_path, nc_checkpoint_file=None, state_index=None, replica_index=None,
                           start_frame=0, end_frame=-1, skip_frame=1, keep_solvent=True,
                           discard_equilibration=False, image_molecules=False):
        """Extract phase trajectory from the NetCDF4 file.
    
    
    Severity: Minor
    Found in Yank/analyze.py - About 7 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_all_analysis has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_all_analysis(self, serialize_data=True, serial_data_path=None, **analyzer_kwargs):
            """
            Run all the automatic analysis through the :func:`ExperimentAnalyzer.auto_analyze`
    
            Parameters
    Severity: Minor
    Found in Yank/analyze.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 extract_trajectory has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def extract_trajectory(nc_path, nc_checkpoint_file=None, state_index=None, replica_index=None,
    Severity: Major
    Found in Yank/analyze.py - About 1 hr to fix

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

          def get_experiment_free_energy_data(self):
              """
              Get the free Yank Experiment free energy, broken down by phase and total experiment
      
              Output is of the form:
      Severity: Minor
      Found in Yank/analyze.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 get_equilibration_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_equilibration_data(self, discard_from_start=1):
              """
              Create the equilibration scatter plots showing the trend lines, correlation time,
              and number of effective samples
      
      
      Severity: Minor
      Found in Yank/analyze.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 print_analysis_data has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def print_analysis_data(analysis_data, header=None):
          """
          Helper function of printing the analysis data payload from a :func:`ExperimentAnalyzer.auto_analyze` call
      
          Parameters
      Severity: Minor
      Found in Yank/analyze.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 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, store_directory, **analyzer_kwargs):
              # Convert analyzer string quantities into variables.
              for key, value in analyzer_kwargs.items():
                  try:
                      quantity = utils.quantity_from_string(value)
      Severity: Minor
      Found in Yank/analyze.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 get_general_simulation_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_general_simulation_data(self):
              """
              General purpose simulation data on number of iterations, number of states, and number of atoms.
              This just prints out this data in a regular, formatted pattern.
      
      
      Severity: Minor
      Found in Yank/analyze.py - About 25 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