tue-robotics/robot_skills

View on GitHub

Showing 30 of 57 total issues

Function update_entity has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

    def update_entity(self, id, type = None, posestamped = None, flags = None, add_flags = [], remove_flags = [], action = None):
        """
        Updates entity
        :param id: entity id
        :param type: entity type
Severity: Minor
Found in src/robot_skills/world_model_ed.py - About 5 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 arms.py has 324 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#! /usr/bin/env python

import rospy
import std_msgs.msg
import tf_server
Severity: Minor
Found in src/robot_skills/arms.py - About 3 hrs to fix

    File mockbot.py has 280 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #! /usr/bin/env python
    import random
    from collections import defaultdict
    
    import geometry_msgs
    Severity: Minor
    Found in src/robot_skills/mockbot.py - About 2 hrs to fix

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

          def indent(self, elem, level=0):
              i = "\n" + level*"  "
              if len(elem):
                  if not elem.text or not elem.text.strip():
                      elem.text = i + "  "
      Severity: Minor
      Found in src/robot_skills/util/nav_analyzer.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 _send_joint_trajectory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _send_joint_trajectory(self, joints_references, timeout=rospy.Duration(5), joint_names = None):
              '''
              Low level method that sends a array of joint references to the arm.
      
              If timeout is defined, it will wait for timeout*len(joints_reference) seconds for the
      Severity: Minor
      Found in src/robot_skills/arms.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 send_goal has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def send_goal(self, px, py, pz, roll, pitch, yaw,
      Severity: Major
      Found in src/robot_skills/arms.py - About 1 hr to fix

        Function _send_goal has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def _send_goal(self, torso_pos, timeout=0.0, tolerance = []):
                rospy.logdebug("Send torso goal {0}, timeout = {1}".format(torso_pos, timeout))
        
                if len(torso_pos) != len(self.joint_names):
                    rospy.logwarn('Length of desired torso pos {0} does not correspond with number of joints {1}'.format(len(torso_pos), len(self.joint_names)))
        Severity: Minor
        Found in src/robot_skills/torso.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 PoseStamped has 10 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def PoseStamped(x=0, y=0, z=0, phi=0,
        Severity: Major
        Found in src/robot_skills/util/msg_constructors.py - About 1 hr to fix

          Function speak has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def speak(self, sentence, language=None, personality=None, voice=None, mood=None, block=True, replace={"_":" "}):
                  """
                  Send a sentence to the text to speech module.
                  You can set language, personality, voice and mood for the Phiips TTS.
                  When block=False, this method returns immediatly.
          Severity: Minor
          Found in src/robot_skills/speech.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 close has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def close(self):
                  try:
                      self.head.close()
                  except: pass
          
          
          Severity: Minor
          Found in src/robot_skills/robot.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 __init__ has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def __init__(self, robot_name):
          
                  self._robot_name = robot_name
                  self.rosbag = False
                  rospy.loginfo("Nav_analyser: Bagging = {0}".format(self.rosbag))
          Severity: Minor
          Found in src/robot_skills/util/nav_analyzer.py - About 1 hr to fix

            Function _setHeadReferenceGoal has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def _setHeadReferenceGoal(self, goal_type, pan_vel, tilt_vel, end_time, point_stamped=PointStamped(), pan=0, tilt=0, timeout=0):
            Severity: Major
            Found in src/robot_skills/head.py - About 1 hr to fix

              Function Pose has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def Pose(x=0, y=0, z=0, phi=0, roll=0, pitch=0, yaw=0):
              Severity: Major
              Found in src/robot_skills/util/msg_constructors.py - About 50 mins to fix

                Function speak has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def speak(self, sentence, language=None, personality=None, voice=None, mood=None, block=True, replace={"_":" "}):
                Severity: Major
                Found in src/robot_skills/speech.py - About 50 mins to fix

                  Function Quaternion has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def Quaternion(x=0, y=0, z=0, w=0, roll=0, pitch=0, yaw=0):
                  Severity: Major
                  Found in src/robot_skills/util/msg_constructors.py - About 50 mins to fix

                    Function update_entity has 7 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def update_entity(self, id, type = None, posestamped = None, flags = None, add_flags = [], remove_flags = [], action = None):
                    Severity: Major
                    Found in src/robot_skills/world_model_ed.py - About 50 mins to fix

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

                      def PointStamped(x=0, y=0, z=0, frame_id="/map", stamp=None, point=None):
                      Severity: Minor
                      Found in src/robot_skills/util/msg_constructors.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if not first:
                                                    json_entity += ','
                                                json_entity += '{"%s":"%s"}' % (k,v)
                        Severity: Major
                        Found in src/robot_skills/world_model_ed.py - About 45 mins to fix

                          Consider simplifying this complex logical expression.
                          Open

                              if x or y or z or w:
                                  return gm.Quaternion(x, y, z, w)
                              elif roll or pitch or yaw:
                                  quat_parts = tf.transformations.quaternion_from_euler(roll, pitch, yaw)
                                  quat = Quaternion(*quat_parts)
                          Severity: Major
                          Found in src/robot_skills/util/msg_constructors.py - About 40 mins to fix

                            Function look_at_point has 5 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def look_at_point(self, point_stamped, end_time=0, pan_vel=1.0, tilt_vel=1.0, timeout=0):
                            Severity: Minor
                            Found in src/robot_skills/head.py - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language