matteoferla/Fragmenstein

View on GitHub
fragmenstein/monster/_util_compare.py

Summary

Maintainability
B
4 hrs
Test Coverage

Function convert_origins_to_custom_map has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def convert_origins_to_custom_map(self, mol: Optional[Chem.Mol] = None, forbiddance=True) -> Dict[
        str, Dict[int, int]]:
        """
        The origins stored in the followup differ in format from the custom_map.
        The former is a list of lists of hit_name+atom_index,
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 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 store_origin_colors_atomically has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def store_origin_colors_atomically(self):
        """
        Store the color of the origin in the mol as the private property _color
        :return:
        """
Severity: Minor
Found in fragmenstein/monster/_util_compare.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 draw has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def draw(mol, color_map, x=200, y=200, **kwargs):
Severity: Minor
Found in fragmenstein/monster/_util_compare.py - About 35 mins to fix

    There are no issues that match your filters.

    Category
    Status