matteoferla/Fragmenstein

View on GitHub
fragmenstein/monster/_place_modes/_expand.py

Summary

Maintainability
C
7 hrs
Test Coverage

Function _expand_hit_atom_map_by_overlap has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    def _expand_hit_atom_map_by_overlap(self,
                                        hit_name: str,
                                        hit_atom_map: Dict[int, int],
                                        positional_overlaps: Dict[Tuple[str, str], Dict[int, int]],
                                        custom_map: Dict[str, Dict[int, int]]) -> Dict[str, Dict[int, int]]:
Severity: Minor
Found in fragmenstein/monster/_place_modes/_expand.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 by_expansion has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def by_expansion(self, primary_name: Optional[str] = None, min_mode_index: int = 0) -> Chem.Mol:
        """
        Get the maps. Find the map with the most atoms covered.
        Use that map as the base map for the other maps.
        """
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 _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 _place_unmerger_expansions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _place_unmerger_expansions(self, unmergers: List[Unmerge]) -> Tuple[Chem.Mol, List[Chem.Mol]]:
        scores: List[int] = []
        mol_options = []
        best_mol = None
        for unmerger in unmergers:
Severity: Minor
Found in fragmenstein/monster/_place_modes/_expand.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 _get_unmerge_expansions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_unmerge_expansions(self,
                                primary_name: str,
                                primary_maps: List[Dict[int, int]],
                                positional_overlaps: Dict[Tuple[str, str], Dict[int, int]],
                                min_mode_index: int) -> List[Unmerge]:
Severity: Minor
Found in fragmenstein/monster/_place_modes/_expand.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

There are no issues that match your filters.

Category
Status