matteoferla/Fragmenstein

View on GitHub
fragmenstein/monster/_merge.py

Summary

Maintainability
C
1 day
Test Coverage

Function simply_merge_hits has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

    def simply_merge_hits(self,
                          hits: Optional[List[Chem.Mol]] = None,
                          linked: bool = True,
                          ) -> Chem.Mol:
        """
Severity: Minor
Found in fragmenstein/monster/_merge.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

File _merge.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

########################################################################################################################

__doc__ = \
    """
Combine => merge/join
Severity: Minor
Found in fragmenstein/monster/_merge.py - About 2 hrs 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 _merge_part has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _merge_part(self, scaffold: Chem.Mol, fragmentanda: Chem.Mol, anchor_index: int,
    Severity: Minor
    Found in fragmenstein/monster/_merge.py - About 45 mins to fix

      Function _prevent_two_bonds_on_dummy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _prevent_two_bonds_on_dummy(self, mol: Chem.RWMol):
              """
              The case '*(C)C' is seen legitimately in some warheads... but in most cases these are not.
      
              :param mol:
      Severity: Minor
      Found in fragmenstein/monster/_merge.py - About 45 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 _pre_fragment_pairs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _pre_fragment_pairs(self, scaffold: Chem.Mol, fragmentanda: Chem.Mol, A2B_mapping: Optional = None) \
                  -> Dict[int, List[Dict]]:
              """
              Returns
      
      
      Severity: Minor
      Found in fragmenstein/monster/_merge.py - About 45 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 _merge_part has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _merge_part(self, scaffold: Chem.Mol, fragmentanda: Chem.Mol, anchor_index: int,
                          attachment_details: List[Dict],
                          other_attachments: List[int],
                          other_attachment_details: List[List[Dict]]) -> Chem.Mol:
              """
      Severity: Minor
      Found in fragmenstein/monster/_merge.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