matteoferla/Fragmenstein

View on GitHub

Showing 254 of 254 total issues

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

    def from_files(cls, folder: str) -> _VictorUtils:  # future.annotation is active, so no cyclical.
        """
        This creates an instance form the output files. Likely to be unstable.
        Assumes the checkpoints were not altered.
        And is basically for analysis only.
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

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

    def get_completed(self, futures: pebble.ProcessMapFuture) -> pd.DataFrame:
        """
        A pebble.ProcessMapFuture cannot be stored as an instance attribute as it's not picklable
        as it handles the lock. As a result it must be passed.

Severity: Minor
Found in fragmenstein/laboratory/_base.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

mRMSD has 21 functions (exceeds 20 allowed). Consider refactoring.
Open

class mRMSD:
    """Mols are non-superposed ('aligned') for the RMSD and in Å.

    The RMSD has been calculated differently.
    The inbuilt RMSD calculations in RDKit (``Chem.rdMolAlign.GetBestRMS``) align the two molecules,
Severity: Minor
Found in fragmenstein/m_rmsd.py - About 2 hrs to fix

    Function _is_connected_warhead has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def _is_connected_warhead(self, atom, anchor_atom):
            if not atom.HasProp('_Warhead'):
                return False
            elif atom.GetBoolProp('_Warhead') == False:
                return False
    Severity: Minor
    Found in fragmenstein/monster/_communal.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 _mapping_from_annotated_and_hits has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def _mapping_from_annotated_and_hits(cls,
                                             annotated_followup: Chem.Mol,
                                             hits: Sequence[Chem.Mol]):
            assert cls.is_origin_annotated(annotated_followup), 'This molecules is not annotated.'
            mappings = []
    Severity: Minor
    Found in fragmenstein/m_rmsd.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 combine_for_bondorder has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def combine_for_bondorder(template: Chem.Mol, target: Chem.Mol) -> Chem.Mol:
        target2template = {}
        for template_ai, template_atom in enumerate(template.GetAtoms()):
            target_atom: Chem.Atom = get_equivalent(template_atom, target)
            target_ai: int = target_atom.GetIdx()
    Severity: Minor
    Found in fragmenstein/extraction_funs.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 pipeline has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def pipeline(self, args: argparse.Namespace):
            """
            Performs a pipeline run of fragmenstein:
            places the hits against themselves as a reference ("replace") to get a baseline score
            combines the hits,
    Severity: Minor
    Found in fragmenstein/cli/pipeline.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 overannotate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def overannotate(cls, mol: Chem.Mol, hits: List[Chem.Mol], priority=('mol_origin', 'atom_origin', 'xyz')):
            """
            Unfortunately, in an attempt to make users happy, I have to make the code more complicated.
            There are three different annotation systems going on.
            The first is the property '_Origin' in the ``Chem.Mol``.
    Severity: Minor
    Found in fragmenstein/m_rmsd.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 convert_origins_to_custom_map has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def convert_origins_to_custom_map(self, mol: Optional[Chem.Mol] = None, forbiddance=True) -> Dict[
            str, Dict[int, int]]:
            """
            The origins stored in the followup differ in format from the custom_map.
            The former is a list of lists of hit_name+atom_index,
    Severity: Minor
    Found in fragmenstein/monster/_util_compare.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 calculate has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def calculate(self, accounted_for: set):
            """perform the calculations"""
    
            #  ---- sorters  --------------------
            goodness_sorter = self.goodness_sorter_factory(3)
    Severity: Minor
    Found in fragmenstein/monster/unmerge_mapper.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 __call__ has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self,  # noqa signature matches... it is just Boost being Boost
                     parameters: rdFMCS.MCSAtomCompareParameters,
                     mol1: Chem.Mol,
                     atom_idx1: int,
                     mol2: Chem.Mol,
    Severity: Minor
    Found in fragmenstein/monster/mcs_mapping/compare_atom.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 _get_attachment_from_pdbblock_via_pymol has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_attachment_from_pdbblock_via_pymol(self) -> Union[None, Chem.Mol]:
            """
            DEPRACATED. FORMER CODE FOR ``_get_attachment_from_pdbblock``
    
            Yes, yes, I see the madness in using pymol to get an atom for rdkit to make a pose for pyrosetta.
    Severity: Minor
    Found in fragmenstein/victor/_victor_common.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 copy_all_possible_origins has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def copy_all_possible_origins(cls, annotated: Chem.Mol, target: Chem.Mol) -> Tuple[List[Chem.Mol], List[List[int]]]:
            """
            Monster leaves a note of what it did. atom prop _Origin is a json of a list of mol _Name dot AtomIdx.
            However, the atom order seems to be maintained but I dont trust it. Also dummy atoms are stripped.
    
    
    Severity: Minor
    Found in fragmenstein/m_rmsd.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 _add_warhead_mapping has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def _add_warhead_mapping(self, custom_map: Dict[str, IndexMap]) -> Dict[str, IndexMap]:
            """
            Add the warhead mapping to the custom_map.
            Does not use the warhead definition as it may be missing.
    
    
    Severity: Minor
    Found in fragmenstein/monster/_place.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 by_expansion has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def by_expansion(self, primary_name: Optional[str] = None, min_mode_index: int = 0) -> Chem.Mol:
            """
            Get the maps. Find the map with the most atoms covered.
            Use that map as the base map for the other maps.
            """
    Severity: Minor
    Found in fragmenstein/monster/_place_modes/_expand.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 flip_mapping has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def flip_mapping(mapping):
        """
        This is a temporary fix for the fact that many route run on mappings that go hit to followup or viceversa
        Moving forward these will be replaced with a single hit to followup scheme, of type IndexMap
        """
    Severity: Minor
    Found in fragmenstein/monster/mcs_mapping/utils.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 _renumber_original_indices has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def _renumber_original_indices(self, mol: Chem.Mol,
                                       mapping: Dict[int, int],
                                       name_restriction: Optional[str] = None):
            """
            Renumbers the indices in the ring virtual atom to new mapping.
    Severity: Minor
    Found in fragmenstein/monster/_collapse_ring.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 posthoc_refine has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

        def posthoc_refine(self,
                           scaffold: Chem.Mol,
                           indices: Optional[List[int]] = None) -> Chem.Mol:
            """
            Given a scaffold and a list of indices, refine the scaffold.
    Severity: Minor
    Found in fragmenstein/monster/_place_modes/_refine.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 41 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self,
                     hits: List[Chem.Mol],
                     pdb_filename: Union[None, str] = None,
                     pdb_block: Union[None, str] = None,
                     ligand_resn: str = 'LIG',
    Severity: Minor
    Found in fragmenstein/victor/_victor_base.py - About 1 hr to fix

      Function check_possible_distances has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def check_possible_distances(self, other, possible_map, combined, combined_map, cutoff=2.5):
              for i, offset_o in possible_map.items():
                  unoffset_o = offset_o - combined.GetNumAtoms()
                  atom = self.followup.GetAtomWithIdx(i)
                  for neigh in atom.GetNeighbors():
      Severity: Minor
      Found in fragmenstein/monster/unmerge_mapper.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

      Severity
      Category
      Status
      Source
      Language