matteoferla/Fragmenstein

View on GitHub

Showing 254 of 254 total issues

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

    def _add_bond_if_possible(self, mol, first: Chem.Atom, second: Chem.Atom, provenance='other_novel'):
        """
        This method is used by _copy_bonding, but triggered when force=False

        :param mol:
Severity: Minor
Found in fragmenstein/monster/_communal.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_bonding has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def _copy_bonding(self, mol, keeper_idx: int, reject_idx: int, force: Optional[bool] = None):
        """
        formerly called `absorb`. Preps for absorbing. remove reject_idx separately.
        So copy bonding from reject_idx to keeper_idx.

Severity: Minor
Found in fragmenstein/monster/_communal.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 from_internal_xyz has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def from_internal_xyz(cls, annotated_followup):
        """
        This is an alternative for when the atoms have _x, _y, _z
        
        :param annotated_followup:
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 __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self,
Severity: Major
Found in fragmenstein/victor/_victor_base.py - About 1 hr to fix

    Function _categorize has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _categorize(self, mol: Chem.Mol, uniques: set) -> Dict[str, Union[set, Dict]]:
            """
            What do the novel atoms do in terms of connectivity.
            Complicated dict output (called ``categories`` in the methods). Really ought to be SetProp of the atoms.
    
    
    Severity: Minor
    Found in fragmenstein/monster/_merge.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 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_attachment_from_pdbblock(self) -> Union[None, Chem.Mol]:
            """
            ``find_attachment`` finds the actual attachment atom not the stated one.
            The historic code for this is now ``_get_attachment_from_pdbblock_via_pymol``
            :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 _detriangulate has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _detriangulate(self, mol: Chem.RWMol) -> None:
            """
            Prevents novel cyclopropanes and cyclobutanes.
    
            :param mol:
    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 make_pse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_pse(self,
                     filename: str = 'combo.pse',
                     extra_mols: Optional[Chem.Mol] = None):
            """
            Save a pse in the relevant folder. This is the Victor one.
    Severity: Minor
    Found in fragmenstein/victor/_victor_show.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_pse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def make_pse(self, filename='test.pse', extra_mols: Optional[Iterable[Chem.Mol]] = None):
            """
            This is specifically for debugging the full fragment merging mode.
            For general use. Please use the Victor method ``make_pse``.
    
    
    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 bond has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def bond(self, idx: Optional[int] = None) -> Chem.Mol:
            """
            Add bonds. As in the verb 'to bond' ...
            """
            if idx is None:
    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 _determine_mergers_novel_other_pair has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def _determine_mergers_novel_other_pair(self,
                                                mol: Chem.RWMol,
                                                ringcore: Chem.Atom,
                                                other: Chem.Atom) -> List[Tuple[int, int]]:
            """
    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 restrain has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def restrain(self, system: mm.System, pdb: Union[mma.PDBFile, mma.Modeller],
                     k: float = 1_000.0,
                     atom_indices: Sequence[int] = (),
                     **args):
            """
    Severity: Minor
    Found in fragmenstein/openmm/fritz.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 sw_search has 11 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def sw_search(cls, combinations: pd.DataFrame, suffix: str,
    Severity: Major
    Found in fragmenstein/laboratory/_extras.py - About 1 hr to fix

      Function from_files has 34 lines of code (exceeds 25 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 1 hr to fix

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

        def _add_mol(self, mol, name=None, carbon_color: Optional[str] = None, opacity=1., **kwargs):
            """
            Whereas there is ``IPythonConsole.addMolToView(caffeine, view)`` in rdkit using py3Dmol,
            I want more.
        
        
        Severity: Minor
        Found in fragmenstein/mol3d_display.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 merge_pairing_lists has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def merge_pairing_lists(self,
                                    nonunique_pairs: List[Tuple[Chem.Atom, Chem.Atom]],
                                    ringcore_first=True) \
                    -> List[Tuple[Chem.Atom, Chem.Atom]]:
                # complicated because mol.GetAtomWithIdx(2) == mol.GetAtomWithIdx(2) is False
        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 place has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def place(self,
                      mol: Chem.Mol,
                      attachment: Optional[Chem.Mol] = None,
                      custom_map: Optional[Dict[str, Dict[int, int]]] = None,
                      merging_mode: str = 'expansion',
        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 _check_custom_map has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _check_custom_map(self, mol: Chem.Mol) -> bool:
                """
                Check that the custom map is satisfied by the molecule.
                """
                originses: List[List[str]] = self.origin_from_mol(mol)
        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 origin_from_mol has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def origin_from_mol(self, mol: Chem.Mol = None):
                """
                these values are stored from Monster for scaffold, chimera and positioned_mol
                See `make_chimera` or `place_from_map` for more info on _Origin
        
        
        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 sw_search has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def sw_search(cls, combinations: pd.DataFrame, suffix: str,
                          sw_dist: int, sw_length: int,
                          sw_db: str,
                          top_mergers: int=1_000,
                          ranking: Optional[str] = None, ranking_ascending: Optional[bool] = None,
        Severity: Minor
        Found in fragmenstein/laboratory/_extras.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