matteoferla/Fragmenstein

View on GitHub
fragmenstein/laboratory/_base.py

Summary

Maintainability
C
1 day
Test Coverage

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

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

def binarize(mol:Chem.Mol, ignore_errors:bool=True) -> bytes:
    """
    Wrapper for ``mol.ToBinary(propertyFlags=0b00010111)``, but with safeguards in case it's not a valid Chem.Mol.
    This is convoluted as None is a common error outcome with RDKit
    So making it less cryptic
Severity: Minor
Found in fragmenstein/laboratory/_base.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

Function __call__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __call__(self,
Severity: Major
Found in fragmenstein/laboratory/_base.py - About 50 mins to fix

    Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, pdbblock: str,
    Severity: Minor
    Found in fragmenstein/laboratory/_base.py - About 45 mins to fix

      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

      Avoid too many return statements within this function.
      Open

                  return 'too moved'
      Severity: Major
      Found in fragmenstein/laboratory/_base.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 100 - int(single_origin[sorted_names[0]] / sum(single_origin.values()) * 100)
        Severity: Major
        Found in fragmenstein/laboratory/_base.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 'equally sized'
          Severity: Major
          Found in fragmenstein/laboratory/_base.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 'too contorted'
            Severity: Major
            Found in fragmenstein/laboratory/_base.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return 'acceptable'
              Severity: Major
              Found in fragmenstein/laboratory/_base.py - About 30 mins to fix

                Function __call__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __call__(self,
                                 iterator: Iterator,
                                 fun: Callable,
                                 n_cores: int = -1,
                                 timeout: int = 240,
                Severity: Minor
                Found in fragmenstein/laboratory/_base.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