matteoferla/Fragmenstein

View on GitHub
fragmenstein/monster/_ff.py

Summary

Maintainability
C
1 day
Test Coverage

Function mmff_minimize has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def mmff_minimize(self,
                      mol: Optional[Chem.Mol] = None,
                      neighborhood: Union[Chem.Mol, None] = None,
                      ff_max_displacement: float = 0.,
                      ff_constraint: int = 10,
Severity: Minor
Found in fragmenstein/monster/_ff.py - About 4 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

File _ff.py has 291 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from ._utility import _MonsterUtil
from rdkit import Chem
from rdkit.Chem import AllChem, rdqueries, rdMolAlign
from rdkit import ForceField as FF
from typing import Optional, List, Union, Tuple, Dict
Severity: Minor
Found in fragmenstein/monster/_ff.py - About 3 hrs to fix

    Function extract_atoms has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_atoms(cls, protein: Chem.Mol, keepers: List[int], expand_aromatics: bool = True) -> Chem.Mol:
            """
            Extract the given atom indices (``keepers``) from ``protein``.
            Expanding to full aromatic ring and copying conformers
            """
    Severity: Minor
    Found in fragmenstein/monster/_ff.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 mmff_minimize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def mmff_minimize(self,
    Severity: Major
    Found in fragmenstein/monster/_ff.py - About 50 mins to fix

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

          def MMFF_score(self, mol: Optional[Chem.Mol] = None, delta: bool = False, mode: str = 'MMFF') -> float:
              """
              Merck force field. Chosen over Universal for no reason at all.
      
              :param mol: ligand
      Severity: Minor
      Found in fragmenstein/monster/_ff.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

      Avoid too many return statements within this function.
      Open

                  return self.mmff_minimize(mol,
      Severity: Major
      Found in fragmenstein/monster/_ff.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return MinizationOutcome(success=success,
        Severity: Major
        Found in fragmenstein/monster/_ff.py - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status