choderalab/protons

View on GitHub
protons/scripts/run_prep_ffxml.py

Summary

Maintainability
D
2 days
Test Coverage

Function run_prep_ffxml_main has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
Open

def run_prep_ffxml_main(jsonfile):
    """Main simulation loop."""

    log.info(f"Preparing a run from '{jsonfile}'")

Severity: Minor
Found in protons/scripts/run_prep_ffxml.py - About 1 day 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

File run_prep_ffxml.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This script instantiates a file for running constant-pH simulation

import os
import signal
import sys
Severity: Minor
Found in protons/scripts/run_prep_ffxml.py - About 4 hrs to fix

    Function run_prep_ffxml_main has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def run_prep_ffxml_main(jsonfile):
        """Main simulation loop."""
    
        log.info(f"Preparing a run from '{jsonfile}'")
    
    
    Severity: Minor
    Found in protons/scripts/run_prep_ffxml.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          for res_id, state_id in enumerate(state_combination):
                              driver.set_titration_state(
                                  res_id,
                                  state_id,
                                  updateContextParameters=True,
      Severity: Major
      Found in protons/scripts/run_prep_ffxml.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if "preprocessing" in settings:
                                simulation.minimizeEnergy(
                                    tolerance=pre_run_minimization_tolerance,
                                    maxIterations=minimization_max_iterations,
                                )
        Severity: Major
        Found in protons/scripts/run_prep_ffxml.py - About 45 mins to fix

          There are no issues that match your filters.

          Category
          Status