matteoferla/Fragmenstein

View on GitHub

Showing 254 of 254 total issues

Function fix_columns has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def fix_columns(self, df: pd.DataFrame, preferred_name: str, options: List[str]):
        if preferred_name not in df.columns:
            for name_col in options:
                for variant_fx in [str.lower, str.upper, str.title]:
                    alt = variant_fx(name_col)  # noqa
Severity: Minor
Found in fragmenstein/cli/laboratory.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 categorize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def categorize(self,
                   row: pd.Series,
                   size_tolerance: int=0,
                   move_cutoff:float=1.,
                   ddG_cutoff:float=0.,
Severity: Minor
Found in fragmenstein/laboratory/_base.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 create_polygon has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def create_polygon(n=6, radius=1.5,
Severity: Major
Found in fragmenstein/walton/_polygon.py - About 1 hr to fix

    Function _combine_ops has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _combine_ops(cls,
    Severity: Major
    Found in fragmenstein/laboratory/_extras.py - About 1 hr to fix

      Function get_color_origins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_color_origins(self) -> Dict[str, Dict[int, str]]:
              """
              Get for the hits and followup the color of the origin
              as seen in show_comparison
              :return:
      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 make_maps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def make_maps(cls, target: Chem.Mol, mols: List[Chem.Mol], mode: Optional[Dict[str, Any]] = None) \
                  -> Dict[str, List[Dict[int, int]]]:
              """
              This is basically if someone is using this class outside of Monster
      
      
      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 guess_origins has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def guess_origins(self, mol: Chem.Mol = None, hits: Optional[List[Chem.Mol]] = None):
              """
              Given a positioned mol guess its origins...
      
              :param mol:
      Severity: Minor
      Found in fragmenstein/monster/_utility.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 make_coordinate_constraints_for_combination has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def make_coordinate_constraints_for_combination(self):
              """
              See also ``cls.make_coordinate_constraints_for_placement``.
              This operates based on ``atom.HasProp('_Novel')``, not origins!
              :return:
      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 find_attachment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

      def find_attachment(pdb: Chem.Mol, ligand_resn: str) -> Tuple[Union[Chem.Atom, None], Union[Chem.Atom, None]]:
          """
          Finds the two atoms in a crosslink bond without looking at LINK record
      
          :param pdb: a rdkit Chem object
      Severity: Minor
      Found in fragmenstein/extraction_funs.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_bonds has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _add_bonds(self):
              """
              Add bonds from aft to mod, a copy of fore.
              Called by combine().
              Will add property 'provenance' to bonds, with values 'fore' or 'aft' or 'common' or 'semicommon'.
      Severity: Minor
      Found in fragmenstein/faux_victors/mcs_monster.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 _con_embed has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _con_embed(self, trial: int = 0) -> None:
              slimmed = Chem.RWMol(self.positioned_mol)
              keepers = []
              unkeepers = []
              for atom in slimmed.GetAtoms():
      Severity: Minor
      Found in fragmenstein/faux_victors/mcs_monster.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 transmute_FindMCS_parameters has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def transmute_FindMCS_parameters(
              **mode: Unpack[ExtendedFMCSMode]) -> rdFMCS.MCSParameters:  # noqa lowercase not applicable
          """
          The function ``rdFMCS.FindMCS`` has two ways of being used.
          In one, a series of arguments are passed,
      Severity: Minor
      Found in fragmenstein/monster/mcs_mapping/utils.py - About 1 hr to fix

        Function get_possible_map has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def get_possible_map(self,
        Severity: Major
        Found in fragmenstein/monster/unmerge_mapper.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if dummy_w_dummy and \
                          zeroth.GetSymbol() == '*' and \
                          first.GetSymbol() == '*':
                      distance = 9999
                      dummy_distance = measure_distance(confs[0].GetAtomPosition(i), confs[1].GetAtomPosition(j))
          Severity: Major
          Found in fragmenstein/monster/positional_mapping.py - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                            if len(followup_hetero_neighs) == 1 and len(hit_hetero_neighs) == 1:
                                followup_old, hit_old = followup_atom, hit_atom
                                followup_atom = followup_hetero_neighs[0]
                                hit_atom = hit_hetero_neighs[0]
                                custom_map[hit_name][hit_atom.GetIdx()] = followup_atom.GetIdx()
            Severity: Major
            Found in fragmenstein/monster/_place.py - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                      if residue is None:
                          ## assuming it is LIG then.
                          ligand_selector = pyrosetta.rosetta.core.select.residue_selector.ResidueNameSelector()
                          ligand_selector.set_residue_name3('LIG')
                          m = self._vector2residues(ligand_selector.apply(self.pose))  # noqa its in Igor_min
              Severity: Major
              Found in fragmenstein/igor/_igor_init.py - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if len(mapping) == 0:
                        return mapping
                    # Sequence[Tuple[int, int]] (basic)
                    elif isinstance(mapping, Sequence) and isinstance(mapping[0], tuple) and isinstance(mapping[0][1], int):
                        return [(b, a) for a, b in mapping]
                Severity: Major
                Found in fragmenstein/monster/mcs_mapping/utils.py - About 1 hr to fix

                  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 extract_mol has 8 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def extract_mol(cls,
                    Severity: Major
                    Found in fragmenstein/victor/_victor_utils.py - About 1 hr to fix

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

                          def display_energy(self,
                                             minimized_mol: Union[Chem.Mol, None],
                                             term: Union[str, Enum]='all',
                                             scorefxn: Optional[pyrosetta.ScoreFunction]=None,
                                             colorMap:str='coolwarm') -> Dict[str, float]:
                      Severity: Minor
                      Found in fragmenstein/igor/_igor_utils.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

                      Severity
                      Category
                      Status
                      Source
                      Language