choderalab/protons

View on GitHub
protons/app/proposals.py

Summary

Maintainability
D
2 days
Test Coverage

File proposals.py has 641 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding=utf-8
"""Residue selection moves for protons MC"""
from abc import ABCMeta, abstractmethod
from .logger import log
import copy
Severity: Major
Found in protons/app/proposals.py - About 1 day to fix

    Function from_system has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def from_system(cls, system: openmm.System, indices: Dict[str, int]):
            """Instantiate a COOHDummyMover for a single C-COOH moiety in your system.
    
            Parameters
            ----------
    Severity: Minor
    Found in protons/app/proposals.py - About 2 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 propose_swaps has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def propose_swaps(
            self, swapper: Swapper, delta_cations: int, delta_anions: int
        ) -> Tuple[List[int], List[Tuple[int, int]], float]:
            """Propose ions/waters to swap.
    
    
    Severity: Minor
    Found in protons/app/proposals.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 e_dihedral has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def e_dihedral(
    Severity: Major
    Found in protons/app/proposals.py - About 50 mins to fix

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

          def internal_to_cartesian(
      Severity: Minor
      Found in protons/app/proposals.py - About 35 mins to fix

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

            def e_angle(
        Severity: Minor
        Found in protons/app/proposals.py - About 35 mins to fix

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

              def from_xml(cls, xmltree: etree.Element):
                  """Instantiate a COOHDummyMover class from an lxml Element."""
                  obj = cls()
                  if not xmltree.tag == "COOHDummyMover":
                      raise ValueError(
          Severity: Minor
          Found in protons/app/proposals.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