matteoferla/Fragmenstein

View on GitHub

Showing 254 of 254 total issues

File _collapse_ring.py has 862 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

__doc__ = \
    """
This is the ring collapsing code.
Severity: Major
Found in fragmenstein/monster/_collapse_ring.py - About 2 days to fix

    File _victor_utils.py has 510 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from __future__ import annotations
    ########################################################################################################################
    
    __doc__ = \
        """
    Severity: Major
    Found in fragmenstein/victor/_victor_utils.py - About 1 day to fix

      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

        Function collapse_ring has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

            def collapse_ring(self, mol: Chem.Mol) -> Chem.Mol:
                """
                Collapses a ring(s) into a single dummy atom(s).
                Stores data as JSON in the atom.
        
        
        Severity: Minor
        Found in fragmenstein/monster/_collapse_ring.py - About 6 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 m_rmsd.py has 437 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from __future__ import annotations
        from collections import defaultdict
        ########################################################################################################################
        
        __doc__ = \
        Severity: Minor
        Found in fragmenstein/m_rmsd.py - About 6 hrs to fix

          Function harmonize_warheads has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
          Open

              def harmonize_warheads(self, hits, warhead_harmonisation, covalent_form=True):
                  """
                  Harmonises and marks the atoms with `_Warhead` Prop.
          
                  :param hits:
          Severity: Minor
          Found in fragmenstein/victor/_victor_common.py - About 5 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 unmerge_mapper.py has 393 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          ########################################################################################################################
          
          __doc__ = \
              """
          Unmerge mapper (not inherited) but inherits `positional_mapping.GPM`
          Severity: Minor
          Found in fragmenstein/monster/unmerge_mapper.py - About 5 hrs to fix

            File _communal.py has 379 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            ########################################################################################################################
            __doc__ = \
                """
            This is inherited by all three parents of the place/combine/other group
                """
            Severity: Minor
            Found in fragmenstein/monster/_communal.py - About 5 hrs to fix

              Function parse has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
              Open

                  def parse(self, block:str) -> None:
                      # ---- parse -----------------------------------------
                      if block.find('\n') == -1:
                          raise ValueError(f'No newline found in block: Is {block} a filename?')
                      def starts_with(xrow, name): return xrow.find(name) == 0
              Severity: Minor
              Found in fragmenstein/victor/minimalPDB.py - About 5 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

              _MonsterRing has 37 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class _MonsterRing(_MonsterJoinNeigh):
              
                  def collapse_mols(self, mols: List[Chem.Mol]):
                      mols = [self.collapse_ring(mol) for mol in mols]
                      [self.offset(mol) for mol in mols]
              Severity: Minor
              Found in fragmenstein/monster/_collapse_ring.py - About 4 hrs to fix

                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 _victor_common.py has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                from ._victor_igor import _VictorIgor
                from .minimalPDB import MinimalPDBParser
                import os, re
                from typing import *
                from rdkit import Chem
                Severity: Minor
                Found in fragmenstein/victor/_victor_common.py - About 4 hrs to fix

                  Function place_from_map has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def place_from_map(self,
                                         target_mol: Chem.Mol,
                                         template_mol: Chem.Mol,
                                         atom_map: Optional[Dict] = None,
                                         random_seed=None) -> Chem.Mol:
                  Severity: Minor
                  Found in fragmenstein/monster/_place_modes/_make_chimera.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

                  Function partially_blend_hits has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def partially_blend_hits(self, hits: Optional[List[Chem.Mol]] = None) -> List[Chem.Mol]:
                          """
                          This is the partial merge algorithm, wherein the hits are attempted to be combined.
                          If the combination is bad. It will not be combined.
                          Returning a list of possible options.
                  Severity: Minor
                  Found in fragmenstein/monster/_place_modes/_partial.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

                  Function from_other_annotated_mols has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def from_other_annotated_mols(cls,
                                              followup: Chem.Mol,
                                              hits: Sequence[Chem.Mol],
                                              annotated: Chem.Mol,
                                              ) -> mRMSD:
                  Severity: Minor
                  Found in fragmenstein/m_rmsd.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

                  Function extract_mols has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def extract_mols(cls,
                                       folder: str,
                                       smilesdex: Dict[str, str],
                                       ligand_resn: str = 'LIG',
                                       regex_name: Optional[str]= None,
                  Severity: Minor
                  Found in fragmenstein/victor/_victor_utils.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

                  File _igor_min.py has 322 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  ########################################################################################################################
                  
                  __doc__ = \
                      """
                  Minimisers
                  Severity: Minor
                  Found in fragmenstein/igor/_igor_min.py - About 3 hrs to fix

                    Function make_coordinate_constraints_for_placement has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def make_coordinate_constraints_for_placement(self,
                                                        mol: Optional[Chem.Mol] = None,
                                                        origins: Optional[List[List[str]]] = None,
                                                        std: Optional[List[float]] = None,
                                                        mx: Optional[List[float]] = None) -> str:
                    Severity: Minor
                    Found in fragmenstein/victor/_victor_common.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

                    Function fix_hits has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def fix_hits(self, hits: List[Chem.Mol]) -> List[Chem.Mol]:
                            """
                            Adds the ``_Name`` Prop if needed
                            asserts everything is a Chem.Mol
                            calls ``store_positions``
                    Severity: Minor
                    Found in fragmenstein/monster/_base.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

                    Function __call__ has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __call__(self, row: pd.Series):
                            with contextlib.suppress(cli_default_settings['supressed_exceptions']):
                                if not isinstance(row.minimized_mol, Chem.Mol) or isinstance(row.hit_names, float):
                                    return float('nan'), float('nan')
                                present_tally = 0
                    Severity: Minor
                    Found in fragmenstein/laboratory/_score.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

                    Severity
                    Category
                    Status
                    Source
                    Language