matteoferla/Fragmenstein

View on GitHub
fragmenstein/victor/_victor_utils.py

Summary

Maintainability
D
2 days
Test Coverage

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

    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

    Function extract_mol has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def extract_mol(cls,
                         name: str,
                         filepath: Optional[str] = None,
                         block: Optional[str] = None,
                         smiles: Optional[str] = None,
    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 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 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 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 extract_mols has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def extract_mols(cls,
        Severity: Minor
        Found in fragmenstein/victor/_victor_utils.py - About 45 mins to fix

          Function closest_hit has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def closest_hit(cls, pdb_filenames: List[str],
          Severity: Minor
          Found in fragmenstein/victor/_victor_utils.py - About 35 mins to fix

            Function distance_hits has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def distance_hits(cls, pdb_filenames: List[str],
            Severity: Minor
            Found in fragmenstein/victor/_victor_utils.py - About 35 mins to fix

              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 make_covalent has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def make_covalent(cls, smiles: str,
                                    warhead_name: Optional[str] = None) -> Union[str, None]:
                      """
                      Convert a unreacted warhead to a reacted one in the SMILES
              
              
              Severity: Minor
              Found in fragmenstein/victor/_victor_utils.py - About 25 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 summarize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def summarize(self):
                      if self.error_msg:
                          if self.monster is None:
                              N_constrained_atoms = float('nan')
                              N_unconstrained_atoms = float('nan')
              Severity: Minor
              Found in fragmenstein/victor/_victor_utils.py - About 25 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

              There are no issues that match your filters.

              Category
              Status