matteoferla/Fragmenstein

View on GitHub

Showing 254 of 254 total issues

Function _expand_hit_atom_map_by_overlap has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def _expand_hit_atom_map_by_overlap(self,
                                        hit_name: str,
                                        hit_atom_map: Dict[int, int],
                                        positional_overlaps: Dict[Tuple[str, str], Dict[int, int]],
                                        custom_map: Dict[str, Dict[int, int]]) -> Dict[str, Dict[int, int]]:
Severity: Minor
Found in fragmenstein/monster/_place_modes/_expand.py - About 3 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

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

    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 get_mcs_mappings has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_mcs_mappings(self,
                               hit: Chem.Mol,
                               followup: Chem.Mol,
                               min_mode_index: int = 0,
                               custom_map: Optional[Dict[str, Dict[int, int]]] = None
      Severity: Minor
      Found in fragmenstein/monster/_place_modes/_mappings.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 _join_atoms has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def _join_atoms(self,
                          combo: Chem.RWMol,
                          anchor_A: int,
                          anchor_B: int,
                          distance: float,
      Severity: Minor
      Found in fragmenstein/monster/_join_neighboring.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 simply_merge_hits has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def simply_merge_hits(self,
                                hits: Optional[List[Chem.Mol]] = None,
                                linked: bool = True,
                                ) -> Chem.Mol:
              """
      Severity: Minor
      Found in fragmenstein/monster/_merge.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 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 _join_internally has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def _join_internally(self, mol: Chem.Mol, severe: bool = False) -> Chem.Mol:
              """
              The last check to see if the mol is connected.
              This differs (and calls) ``join_neighboring_mols``
      
      
      Severity: Minor
      Found in fragmenstein/monster/_collapse_ring.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 summarize_interaction has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
      Open

          def summarize_interaction(self, intxn, atom_names: Sequence[str]) -> Dict[str, Any]:
              # https://github.com/openbabel/openbabel/blob/master/data/atomtyp.txt
              # https://blog.matteoferla.com/2023/07/a-note-no-plip-interactions.html
              relevant_atom_names = []
              type_name = intxn.__class__.__name__
      Severity: Minor
      Found in fragmenstein/victor/plip.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

      File _merge.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ########################################################################################################################
      
      __doc__ = \
          """
      Combine => merge/join
      Severity: Minor
      Found in fragmenstein/monster/_merge.py - About 2 hrs to fix

        Function get_possible_map has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_possible_map(self,
                                 other: Chem.Mol,
                                 label: str,
                                 o_map: Dict[int, int],  # followup -> other
                                 inter_map: Dict[int, int],  # other -> combined
        Severity: Minor
        Found in fragmenstein/monster/unmerge_mapper.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 extract_mol has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def extract_mol(cls,
                             name: str,
                             filepath: Optional[str] = None,
                             block: Optional[str] = None,
                             smiles: Optional[str] = None,
        Severity: Minor
        Found in fragmenstein/victor/_victor_utils.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

        File _utility.py has 270 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        ########################################################################################################################
        __doc__ = \
            """
        These are extras for the Monster step
            """
        Severity: Minor
        Found in fragmenstein/monster/_utility.py - About 2 hrs to fix

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

              def per_atom_scores(self,
                                  pose: Optional[pyrosetta.Pose]=None,
                                  target_res: Optional[int]=None,
                                  scorefxn: Optional[pyrosetta.ScoreFunction]=None) -> Dict[str, Dict[str, float]]:
                  """
          Severity: Minor
          Found in fragmenstein/igor/_igor_utils.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 place has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def place(self,
                        queries: Union[pd.DataFrame, Sequence[MolPlacementInput]],
                        expand_isomers: bool = False,
                        **kwargs) -> Union[pebble.ProcessMapFuture, pd.DataFrame]:
                  """
          Severity: Minor
          Found in fragmenstein/laboratory/_place.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

          _MonsterCommunal has 22 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class _MonsterCommunal(_MonsterTracker):
          
              # === Find closest =================================================================================================
              # dep methods:
          
          
          Severity: Minor
          Found in fragmenstein/monster/_communal.py - About 2 hrs to fix

            File mcs_monster.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import json, logging
            from rdkit import Chem, Geometry
            from rdkit.Chem import rdFMCS, AllChem  # noqa
            from typing import Dict
            from molecular_rectifier import Rectifier
            Severity: Minor
            Found in fragmenstein/faux_victors/mcs_monster.py - About 2 hrs to fix

              Function make_chimera has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def make_chimera(self, template: Chem.Mol, min_mode_index=0) -> Chem.Mol:
                      """
                      This is to avoid extreme corner corner cases.
                      E.g. here the MCS is ringMatchesRingOnly=True and AtomCompare.CompareAny,
                      while for the positioning this is not the case.
              Severity: Minor
              Found in fragmenstein/monster/_place_modes/_make_chimera.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 _parse_residue has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _parse_residue(self, residue: Union[int, str, Tuple[int, str], pyrosetta.Vector1]) -> List[int]:
                      """
                      Parse a residue into a list of pose residue indices.
                      This will be called to fill ``self.ligand_residue`` and ``self.key_residues``.
              
              
              Severity: Minor
              Found in fragmenstein/igor/_igor_init.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 _remove_poisonous has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _remove_poisonous(self,
                                        flipped_maps,
                                        poisonous_indices: List[int],
                                        n_poisonous: int,
                                        primary_name:Optional[str]=None) -> None:
              Severity: Minor
              Found in fragmenstein/monster/_place_modes/_no_blending.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

              Severity
              Category
              Status
              Source
              Language