MushroomRL/mushroom-rl

View on GitHub
mushroom_rl/utils/pybullet/contacts.py

Summary

Maintainability
A
2 hrs
Test Coverage
F
23%

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

    def _add_contact(self, model_1, model_2, link_1, link_2):
        model_a, model_b, link_a, link_b = self._order_contact(model_1, model_2, link_1, link_2)

        done = False
        for contact in self._contact_list:
Severity: Minor
Found in mushroom_rl/utils/pybullet/contacts.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 compute_contacts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_contacts(self):
        if len(self._contact_list) == 0:
            return

        self._reset_computed_contacts()
Severity: Minor
Found in mushroom_rl/utils/pybullet/contacts.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 _reset_computed_contacts has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _reset_computed_contacts(self):
        for contact in self._contact_name_map.values():
            model_a, model_b, link_a, link_b = self._order_contact(*contact)

            if model_a not in self._computed_contacts:
Severity: Minor
Found in mushroom_rl/utils/pybullet/contacts.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