project-capo/amber-python-drivers

View on GitHub

Showing 50 of 198 total issues

File roboclaw.py has 745 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import logging
import logging.config
import threading
import time
import math
Severity: Major
Found in src/amberdriver/roboclaw/roboclaw.py - About 1 day to fix

    Roboclaw has 73 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Roboclaw(object):
        def __init__(self, port, rc_address=128):
            self.__port = port
            self.__rc_address = rc_address
    
    
    Severity: Major
    Found in src/amberdriver/roboclaw/roboclaw.py - About 1 day to fix

      File hokuyo_common.py has 342 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import logging
      import logging.config
      import threading
      import sys
      import traceback
      Severity: Minor
      Found in src/amberdriver/hokuyo/hokuyo_common.py - About 4 hrs to fix

        File drive_support_logic.py has 338 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import math
        import collections
        import time
        
        import os
        Severity: Minor
        Found in src/amberdriver/drive_support/drive_support_logic.py - About 4 hrs to fix

          Function compute_new_radius has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

          def compute_new_radius(speeds, scan):
              radius = speeds.radius
              if radius is not None and abs(radius) > 0.0:
                  for angle, distance in sorted(scan.points, key=lambda (a, d): a, reverse=(radius < 0.0)):
                      if 100.0 < distance < 5600.0:
          Severity: Minor
          Found in src/amberdriver/drive_support/drive_support_logic.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 change_radius has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          def change_radius(speeds, radius):
              if radius is None:
                  return
          
              if abs(radius) > 0.0:
          Severity: Minor
          Found in src/amberdriver/drive_support/drive_support_logic.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

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

              def __find_temporary_target(scan, drive_distance, drive_angle, location, current_target):
                  best_current_temporary_distance = None
                  best_temporary_x, best_temporary_y = None, None
                  for angle, distance in sorted(scan.points, key=lambda (a, _): a):
                      if distance > drive_distance:
          Severity: Minor
          Found in src/amberdriver/drive_to_point/drive_to_point.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 hokuyo.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import logging
          import logging.config
          import threading
          import sys
          import time
          Severity: Minor
          Found in src/amberdriver/hokuyo/hokuyo.py - About 2 hrs to fix

            DriveToPoint has 22 functions (exceeds 20 allowed). Consider refactoring.
            Open

            class DriveToPoint(object):
                TIMESTAMP_FIELD = 4
            
                def __init__(self, driver_proxy, location_proxy, hokuyo_proxy):
                    self.__driver_proxy = driver_proxy
            Severity: Minor
            Found in src/amberdriver/drive_to_point/drive_to_point.py - About 2 hrs to fix

              File drive_to_point.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import logging
              import logging.config
              import threading
              import time
              import math
              Severity: Minor
              Found in src/amberdriver/drive_to_point/drive_to_point.py - About 2 hrs to fix

                Function avoid has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                Open

                def avoid(speeds, scan):
                    min_distance_angle, min_distance = get_min_distance(speeds, scan)
                    center_angle = get_angle(speeds.speed_left, speeds.speed_right, ROBO_WIDTH)
                    if min_distance < HARD_DISTANCE_LIMIT + 0.6 * ROBO_WIDTH:
                        if min_distance_angle > 0.0:
                Severity: Minor
                Found in src/amberdriver/drive_support/drive_support_logic.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

                SerialPort has 21 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class SerialPort(object):
                    def __init__(self, serial_port):
                        self.__port = serial_port
                        self.__checksum = 0
                
                
                Severity: Minor
                Found in src/amberdriver/tools/serial_port.py - About 2 hrs to fix

                  HokuyoController has 21 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class HokuyoController(MessageHandler):
                      def __init__(self, pipe_in, pipe_out, port, _disable_assert=False):
                          super(HokuyoController, self).__init__(pipe_in, pipe_out)
                  
                          self.__hokuyo = Hokuyo(port, _disable_assert=_disable_assert)
                  Severity: Minor
                  Found in src/amberdriver/hokuyo/hokuyo_common.py - About 2 hrs to fix

                    Function find_local_minima_func has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def find_local_minima_func(points):
                        prev_distance = None
                        minimum_distance = None
                        minimum_angle = None
                        minimas = []
                    Severity: Minor
                    Found in src/amberdriver/drive_to_point/drive_to_point_logic.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 __drive_to has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __drive_to(self, target, next_targets_timestamp):
                            self.__logger.info('Drive to %s', str(target))
                    
                            location = self.__locator.get_absolute_location()
                    
                    
                    Severity: Minor
                    Found in src/amberdriver/drive_to_point/drive_to_point.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_factor_due_to_distance has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def compute_factor_due_to_distance(scan):
                        factor_cosines = 0.0
                        factor_gauss = 0.0
                        weights_cosines = 0.0
                        weights_gauss = 0.0
                    Severity: Minor
                    Found in src/amberdriver/drive_support/drive_support_logic.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 error_monitor_loop has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def error_monitor_loop(self):
                            no_error = True
                    
                            while self.__is_active:
                                time.sleep(ERROR_MONITOR_INTERVAL / 1000.0)
                    Severity: Minor
                    Found in src/amberdriver/roboclaw/roboclaw.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 drive_mixed_with_signed_speed_accel_deccel_position has 9 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        def drive_mixed_with_signed_speed_accel_deccel_position(self,
                    Severity: Major
                    Found in src/amberdriver/roboclaw/roboclaw.py - About 1 hr to fix

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

                          def scanning_loop(self):
                              while self.__is_active:
                                  if self.__multi_scanning_allowed:
                                      for scan in self.__scanner.get_multiple_scans():
                                          self.__set_scan(scan)
                      Severity: Minor
                      Found in src/amberdriver/hokuyo/hokuyo.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 timeout_monitor_loop has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def timeout_monitor_loop(self):
                              self.__reset_timeouts()
                              while self.__is_active:
                                  current_time = time.time()
                      
                      
                      Severity: Minor
                      Found in src/amberdriver/roboclaw/roboclaw.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

                      Severity
                      Category
                      Status
                      Source
                      Language