matteoferla/Fragmenstein

View on GitHub
fragmenstein/monster/_place.py

Summary

Maintainability
B
5 hrs
Test Coverage

Function _add_warhead_mapping has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def _add_warhead_mapping(self, custom_map: Dict[str, IndexMap]) -> Dict[str, IndexMap]:
        """
        Add the warhead mapping to the custom_map.
        Does not use the warhead definition as it may be missing.

Severity: Minor
Found in fragmenstein/monster/_place.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 has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def place(self,
              mol: Chem.Mol,
              attachment: Optional[Chem.Mol] = None,
              custom_map: Optional[Dict[str, Dict[int, int]]] = None,
              merging_mode: str = 'expansion',
Severity: Minor
Found in fragmenstein/monster/_place.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

Consider simplifying this complex logical expression.
Open

                if len(followup_hetero_neighs) == 1 and len(hit_hetero_neighs) == 1:
                    followup_old, hit_old = followup_atom, hit_atom
                    followup_atom = followup_hetero_neighs[0]
                    hit_atom = hit_hetero_neighs[0]
                    custom_map[hit_name][hit_atom.GetIdx()] = followup_atom.GetIdx()
Severity: Major
Found in fragmenstein/monster/_place.py - About 1 hr to fix

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

        def place(self,
    Severity: Minor
    Found in fragmenstein/monster/_place.py - About 45 mins to fix

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

          def _validate_custom_map(self):
              """
              What on earth has the user submitted as custom_map?
      
              :return:
      Severity: Minor
      Found in fragmenstein/monster/_place.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