matteoferla/Fragmenstein

View on GitHub
fragmenstein/openmm/fritz.py

Summary

Maintainability
D
2 days
Test Coverage

File fritz.py has 466 lines of code (exceeds 250 allowed). Consider refactoring.
Open

########################################################################################################################

__doc__ = \
    """
    See GitHub documentation
Severity: Minor
Found in fragmenstein/openmm/fritz.py - About 7 hrs to fix

    Fritz has 27 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Fritz:
        """
        Fritz is a helper class for Victor for use with OpenMM.
        It replaces Igor, the pyrosetta one.
    
    
    Severity: Minor
    Found in fragmenstein/openmm/fritz.py - About 3 hrs to fix

      Function restrain has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def restrain(self, system: mm.System, pdb: Union[mma.PDBFile, mma.Modeller],
                       k: float = 1_000.0,
                       atom_indices: Sequence[int] = (),
                       **args):
              """
      Severity: Minor
      Found in fragmenstein/openmm/fritz.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in fragmenstein/openmm/fritz.py - About 1 hr to fix

        Function create_simulation has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_simulation(self,
                                  model: Union[mma.PDBFile, mma.Modeller, None] = None,
                                  restraint_k: float = 1_000,
                                  restraining_atom_indices: Sequence[int] = (),
                                  mobile_radius: float = 8.0,
        Severity: Minor
        Found in fragmenstein/openmm/fritz.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 correct_pdbinfo has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def correct_pdbinfo(mol: Chem.Mol, resn: str, resi: int, chain: str):
                """
                In Igor, RDKit to Params fixes it.
                In RDKit MolToPDBBlock https://github.com/rdkit/rdkit/blob/32655f5365e363ce13bd6b28e2e9e2544f8680bd/Code/GraphMol/FileParsers/PDBWriter.cpp#L66
                it is hidden.
        Severity: Minor
        Found in fragmenstein/openmm/fritz.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 restrain has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def restrain(self, system: mm.System, pdb: Union[mma.PDBFile, mma.Modeller],
        Severity: Minor
        Found in fragmenstein/openmm/fritz.py - About 35 mins to fix

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

              def create_simulation(self,
          Severity: Minor
          Found in fragmenstein/openmm/fritz.py - About 35 mins to fix

            Function shift_ligand has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def shift_ligand(self, simulation: mma.Simulation, amount: Union[mmu.Quantity, mm.Vec3, float]):
                    if isinstance(amount, float):
                        amount: mmu.Quantity = mm.Vec3(amount, 0, 0) * mmu.angstrom
                    elif isinstance(amount, mm.Vec3):
                        amount: mmu.Quantity = amount * mmu.angstrom
            Severity: Minor
            Found in fragmenstein/openmm/fritz.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