matteoferla/Fragmenstein

View on GitHub

Showing 254 of 254 total issues

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

    def _get_atom_maps_OLD(self, molA, molB, **mode: Unpack[ExtendedFMCSMode]) -> Set[Tuple[Tuple[int, int]]]:
        """
        The ``mode`` are FindMCS arguments.
        """
        warnings.warn('`_get_atom_maps_OLD` is no longer used.', category=DeprecationWarning)
Severity: Minor
Found in fragmenstein/monster/_place_modes/_mappings.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

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

    def guess_warhead(cls, smiles: str) -> Tuple[str, str]:
        """
        Going backwards by guessing what the warhead is.
        Normally there'd be better data handling so no guessing
        """
Severity: Minor
Found in fragmenstein/victor/_victor_utils.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

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

    def _embed(self, trial=0, **embed_args) -> None:
        """
        At trial 0, all fore atoms are okay
        At trial 1, only fore atoms with bonds with original bonding are okay
        At trial 2, only common atoms with bonds with original bonding are okay
Severity: Minor
Found in fragmenstein/faux_victors/mcs_monster.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

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

    def is_valid(self, atom: Chem.Atom, trial: int):
        """
        Is this a constrainable atom?
        """
        if atom.GetAtomicNum() == 1:
Severity: Minor
Found in fragmenstein/faux_victors/mcs_monster.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

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

def unbinarize(bin: bytes, ignore_errors:bool=True) -> Union[Chem.Mol, None]:
    """
    This is just a wrapper for ``Chem.Mol(bin)``, with safeguards in case it's not a bytes.
    """
    exception = Exception if ignore_errors else ()
Severity: Minor
Found in fragmenstein/laboratory/_base.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

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

    def _atom_origin_to_xyz(cls, origins: List[str], atom: Chem.Atom, hits: List[Chem.Mol]):
        points = []
        if len(hits) == 0:
            return  # no hits
        hitdex: Dict[str, Chem.Mol] = {hit.GetProp('_Name'): hit for hit in hits}
Severity: Minor
Found in fragmenstein/m_rmsd.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

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

    def from_postera_row(cls, row: pd.Series, results:Optional=None):
        if row.fragments == 'x0072' or str(row.fragments) == 'nan':
            # these are not hit inspired.
            cls.journal.error(f'No valid parent hits for {row.CID}.')
            return None
Severity: Minor
Found in fragmenstein/mpro/__init__.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 False
Severity: Major
Found in fragmenstein/monster/_communal.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return {k: self._remove_negatives(v) for k, v in map.items()}
    Severity: Major
    Found in fragmenstein/monster/_place_modes/_no_blending.py - About 30 mins to fix

      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 False
        Severity: Major
        Found in fragmenstein/monster/mcs_mapping/compare_atom.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return False
          Severity: Major
          Found in fragmenstein/monster/_communal.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return False
            Severity: Major
            Found in fragmenstein/monster/mcs_mapping/compare_atom.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return super().__call__(parameters, hit, hit_atom_idx, followup, followup_atom_idx)
              Severity: Major
              Found in fragmenstein/monster/mcs_mapping/compare_atom.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                            return False  # too bonded etc.
                Severity: Major
                Found in fragmenstein/monster/_communal.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return {name: flip_mapping(submapping) for name, submapping in mapping.items()}
                  Severity: Major
                  Found in fragmenstein/monster/mcs_mapping/utils.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return True
                    Severity: Major
                    Found in fragmenstein/monster/mcs_mapping/compare_atom.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return True
                      Severity: Major
                      Found in fragmenstein/monster/_communal.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                    return False
                        Severity: Major
                        Found in fragmenstein/monster/mcs_mapping/compare_atom.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return {h: f for h, f in map.items() if f >= 0 and h >= 0}
                          Severity: Major
                          Found in fragmenstein/monster/_place_modes/_no_blending.py - About 30 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language