CiscoUcs/ucsmsdk

View on GitHub
ucsmsdk/ucseventhandler.py

Summary

Maintainability
F
4 days
Test Coverage

File ucseventhandler.py has 500 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2013 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Minor
Found in ucsmsdk/ucseventhandler.py - About 1 day to fix

    Function _dequeue_function has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def _dequeue_function(self):
            """
            Internal method to dequeue to events.
            """
            while len(self._wbs):
    Severity: Minor
    Found in ucsmsdk/ucseventhandler.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

    UcsEventHandle has 32 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class UcsEventHandle(object):
        """This class provides api to add and remove event handler."""
    
        def __init__(self, handle):
            self._handle = handle
    Severity: Minor
    Found in ucsmsdk/ucseventhandler.py - About 4 hrs to fix

      Cyclomatic complexity is too high in method _dequeue_function. (17)
      Open

          def _dequeue_function(self):
              """
              Internal method to dequeue to events.
              """
              while len(self._wbs):
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _dequeue_mo_prop_poll. (11)
      Open

          def _dequeue_mo_prop_poll(self, mo, prop, poll_sec, watch_block,
                                    timeout_sec=None, time_left=None):
      
              success_value = watch_block.params["success_value"]
      
      
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method add. (9)
      Open

          def add(self,
                  class_id=None,
                  managed_object=None,
                  prop=None,
                  success_value=[],
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method _add_mo_watch. (6)
      Open

          def _add_mo_watch(self, managed_object, prop=None, success_value=[],
                            poll_sec=None):
              if ucscoreutils.find_class_id_in_mo_meta_ignore_case(
                      managed_object.get_class_id()) is None:
                  raise UcsValidationException(
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

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

          def _add_mo_watch(self, managed_object, prop=None, success_value=[],
                            poll_sec=None):
              if ucscoreutils.find_class_id_in_mo_meta_ignore_case(
                      managed_object.get_class_id()) is None:
                  raise UcsValidationException(
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.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 _process_method_vessel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _process_method_vessel(self, root, elems):
              for in_stimuli in root:
                  for cmce in in_stimuli:
                      for in_config in cmce:
                          for mo_elem in in_config:
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.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 _dequeue_mo_prop_poll has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def _dequeue_mo_prop_poll(self, mo, prop, poll_sec, watch_block,
                                    timeout_sec=None, time_left=None):
      
              success_value = watch_block.params["success_value"]
      
      
      Severity: Minor
      Found in ucsmsdk/ucseventhandler.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 add has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def add(self,
      Severity: Major
      Found in ucsmsdk/ucseventhandler.py - About 1 hr to fix

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

        def wait(handle, mo, prop, value, cb, timeout_sec=None, poll_sec=None):
        Severity: Major
        Found in ucsmsdk/ucseventhandler.py - About 50 mins to fix

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

              def add(self,
                      class_id=None,
                      managed_object=None,
                      prop=None,
                      success_value=[],
          Severity: Minor
          Found in ucsmsdk/ucseventhandler.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 _dequeue_mo_prop_poll has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def _dequeue_mo_prop_poll(self, mo, prop, poll_sec, watch_block,
          Severity: Minor
          Found in ucsmsdk/ucseventhandler.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if prop is not None:
                                            self._dequeue_mo_prop_event(prop, watch_block,
                                                                        time_left)
                                        # watch mo until it is removed
                                        else:
            Severity: Major
            Found in ucsmsdk/ucseventhandler.py - About 45 mins to fix

              Function _process_event_channel_resp has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _process_event_channel_resp(self, resp):
                      enqueued = False
              
                      for mo_elem in self._get_mo_elem(resp):
                          gmo = ucsmo.generic_mo_from_xml_elem(mo_elem[0])
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.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 _process_wb_remove_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _process_wb_remove_list(self):
                      if len(self._wb_to_remove) == 0:
                          return
              
                      self._wbs_lock.acquire()
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.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 dequeue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def dequeue(self, miliseconds_timeout):
                      """Internal method to dequeue the events."""
                      while True:
                          if self.error_code != 0:
                              log.debug("queue error:" + str(self.error_code))
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.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

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

                  def _dequeue_mce(self, time_left, watch_block):
                      if time_left and time_left > 0:
                          if self._lowest_timeout is None or \
                                  self._lowest_timeout > time_left:
                              self._lowest_timeout = time_left
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.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

              Method "add" has 9 parameters, which is greater than the 7 authorized.
              Open

                  def add(self,
                          class_id=None,
                          managed_object=None,
                          prop=None,
                          success_value=[],
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              A long parameter list can indicate that a new structure should be created to wrap the numerous parameters or that the function is doing too many things.

              Noncompliant Code Example

              With a maximum number of 4 parameters:

              def do_something(param1, param2, param3, param4, param5):
                  ...
              

              Compliant Solution

              def do_something(param1, param2, param3, param4):
                  ...
              

              Refactor this function to reduce its Cognitive Complexity from 38 to the 15 allowed.
              Open

                  def _dequeue_function(self):
              Severity: Critical
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              Cognitive Complexity is a measure of how hard the control flow of a function is to understand. Functions with high Cognitive Complexity will be difficult to maintain.

              See

              Remove this commented out code.
              Open

                      # return 2147483647
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              Programmers should not comment out code as it bloats programs and reduces readability.

              Unused code should be deleted and can be retrieved from source control history if required.

              See

              • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
              • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
              • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
              • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

              Merge this if statement with the enclosing one.
              Open

                          if time_left < poll_sec:
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              Merging collapsible if statements increases the code's readability.

              Noncompliant Code Example

              if condition1:
                  if condition2:
                      # ...
              

              Compliant Solution

              if condition1 and condition2:
                  # ...
              

              Either merge this branch with the identical one on line "243" or change one of the implementations.
              Open

                          return getattr(mo, python_prop)
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

              Noncompliant Code Example

              if 0 <= a < 10:
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              elif 20 <= a < 50:
                  do_the_thing()  # Noncompliant; duplicates first condition
              else:
                  do_the_rest()
              
              b = 4 if a > 12 else 4
              

              Compliant Solution

              if (0 <= a < 10) or (20 <= a < 50):
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              else:
                  do_the_rest()
              
              b = 4
              

              or

              if 0 <= a < 10:
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              elif 20 <= a < 50:
                  do_the_third_thing()
              else:
                  do_the_rest()
              
              b = 8 if a > 12 else 4
              

              Either merge this branch with the identical one on line "229" or change one of the implementations.
              Open

                          return python_prop
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

              Noncompliant Code Example

              if 0 <= a < 10:
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              elif 20 <= a < 50:
                  do_the_thing()  # Noncompliant; duplicates first condition
              else:
                  do_the_rest()
              
              b = 4 if a > 12 else 4
              

              Compliant Solution

              if (0 <= a < 10) or (20 <= a < 50):
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              else:
                  do_the_rest()
              
              b = 4
              

              or

              if 0 <= a < 10:
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              elif 20 <= a < 50:
                  do_the_third_thing()
              else:
                  do_the_rest()
              
              b = 8 if a > 12 else 4
              

              Either merge this branch with the identical one on line "365" or change one of the implementations.
              Open

                                      self._lowest_timeout = time_left
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py by sonar-python

              Having two branches in the same if structure with the same implementation is at best duplicate code, and at worst a coding error. If the same logic is truly needed for both instances, then they should be combined.

              Noncompliant Code Example

              if 0 <= a < 10:
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              elif 20 <= a < 50:
                  do_the_thing()  # Noncompliant; duplicates first condition
              else:
                  do_the_rest()
              
              b = 4 if a > 12 else 4
              

              Compliant Solution

              if (0 <= a < 10) or (20 <= a < 50):
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              else:
                  do_the_rest()
              
              b = 4
              

              or

              if 0 <= a < 10:
                  do_the_thing()
              elif 10 <= a < 20:
                  do_the_other_thing()
              elif 20 <= a < 50:
                  do_the_third_thing()
              else:
                  do_the_rest()
              
              b = 8 if a > 12 else 4
              

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  def _thread_dequeue_start(self):
                      """
                      Internal method to start dequeue thread.
                      """
              
              
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py and 1 other location - About 1 hr to fix
              ucsmsdk/ucseventhandler.py on lines 195..204

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  def _thread_enqueue_start(self):
                      """
                      Internal method to start the enqueue thread which adds the events in
                      an internal queue.
                      """
              Severity: Major
              Found in ucsmsdk/ucseventhandler.py and 1 other location - About 1 hr to fix
              ucsmsdk/ucseventhandler.py on lines 419..427

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      print('EventId'.ljust(tab_size * 2) + ':' + str(mce.event_id))
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.py and 1 other location - About 55 mins to fix
              ucsmsdk/ucseventhandler.py on lines 94..94

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 37.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      print('ChangeList'.ljust(tab_size * 2) + ':' + str(mce.change_list))
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.py and 1 other location - About 55 mins to fix
              ucsmsdk/ucseventhandler.py on lines 93..93

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 37.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                          if self._lowest_timeout is None or \
                                  self._lowest_timeout > time_left:
                              self._lowest_timeout = time_left
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.py and 1 other location - About 30 mins to fix
              ucsmsdk/ucseventhandler.py on lines 295..296

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                      if self._lowest_timeout is None or self._lowest_timeout > poll_sec:
                          self._lowest_timeout = poll_sec
              Severity: Minor
              Found in ucsmsdk/ucseventhandler.py and 1 other location - About 30 mins to fix
              ucsmsdk/ucseventhandler.py on lines 218..220

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status