saltstack/salt

View on GitHub
salt/minion.py

Summary

Maintainability
F
2 mos
Test Coverage

File minion.py has 2953 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Routines to set up a minion
'''
# Import python libs
Severity: Major
Found in salt/minion.py - About 1 wk to fix

    Function eval_master has a Cognitive Complexity of 138 (exceeds 5 allowed). Consider refactoring.
    Open

        def eval_master(self,
                        opts,
                        timeout=60,
                        safe=True,
                        failed=False,
    Severity: Minor
    Found in salt/minion.py - About 2 days 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 _thread_return has a Cognitive Complexity of 102 (exceeds 5 allowed). Consider refactoring.
    Open

        def _thread_return(cls, minion_instance, opts, data):
            '''
            This method should be used as a threading target, start the actual
            minion side execution.
            '''
    Severity: Minor
    Found in salt/minion.py - About 2 days 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 resolve_dns has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring.
    Open

    def resolve_dns(opts, fallback=True):
        '''
        Resolves the master_ip and master_uri options
        '''
        ret = {}
    Severity: Minor
    Found in salt/minion.py - About 1 day 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 _handle_tag_master_disconnected_failback has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

        def _handle_tag_master_disconnected_failback(self, tag, data):
            '''
            Handle a master_disconnected_failback event
            '''
            # if the master disconnect event is for a different master, raise an exception
    Severity: Minor
    Found in salt/minion.py - About 1 day 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

    Cyclomatic complexity is too high in method _thread_return. (57)
    Open

        @classmethod
        def _thread_return(cls, minion_instance, opts, data):
            '''
            This method should be used as a threading target, start the actual
            minion side execution.
    Severity: Minor
    Found in salt/minion.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 _return_pub_multi has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

        def _return_pub_multi(self, rets, ret_cmd='_return', timeout=60, sync=True):
            '''
            Return the data from the executed command to the master server
            '''
            if not isinstance(rets, list):
    Severity: Minor
    Found in salt/minion.py - About 7 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

    Minion has 54 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Minion(MinionBase):
        '''
        This class instantiates a minion, runs connections for a minion,
        and loads all of the functions into the minion
        '''
    Severity: Major
    Found in salt/minion.py - About 7 hrs to fix

      Cyclomatic complexity is too high in method eval_master. (55)
      Open

          @tornado.gen.coroutine
          def eval_master(self,
                          opts,
                          timeout=60,
                          safe=True,
      Severity: Minor
      Found in salt/minion.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 _thread_multi_return has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
      Open

          def _thread_multi_return(cls, minion_instance, opts, data):
              '''
              This method should be used as a threading target, start the actual
              minion side execution.
              '''
      Severity: Minor
      Found in salt/minion.py - About 6 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 _return_pub has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def _return_pub(self, ret, ret_cmd='_return', timeout=60, sync=True):
              '''
              Return the data from the executed command to the master server
              '''
              jid = ret.get('jid', ret.get('__jid__'))
      Severity: Minor
      Found in salt/minion.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

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

          def _discover_masters(self):
              '''
              Discover master(s) and decide where to connect, if SSDP is around.
              This modifies the configuration on the fly.
              :return:
      Severity: Minor
      Found in salt/minion.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

      Function load_args_and_kwargs has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_args_and_kwargs(func, args, data=None, ignore_invalid=False):
          '''
          Detect the args and kwargs that need to be passed to a function call, and
          check them against what was passed.
          '''
      Severity: Minor
      Found in salt/minion.py - About 4 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 _process_event has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def _process_event(self, raw):
              # TODO: cleanup: Move down into event class
              mtag, data = self.local.event.unpack(raw, self.local.event.serial)
              log.trace('Got event %s', mtag)  # pylint: disable=no-member
      
      
      Severity: Minor
      Found in salt/minion.py - About 4 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 tune_in has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
      Open

          def tune_in(self, start=True):
              '''
              Lock onto the publisher. This is the main event loop for the minion
              :rtype : None
              '''
      Severity: Minor
      Found in salt/minion.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 _handle_decoded_payload has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def _handle_decoded_payload(self, data):
              '''
              Override this method if you wish to handle the decoded data
              differently.
              '''
      Severity: Minor
      Found in salt/minion.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

      Cyclomatic complexity is too high in method _thread_multi_return. (29)
      Open

          @classmethod
          def _thread_multi_return(cls, minion_instance, opts, data):
              '''
              This method should be used as a threading target, start the actual
              minion side execution.
      Severity: Minor
      Found in salt/minion.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 function resolve_dns. (26)
      Open

      def resolve_dns(opts, fallback=True):
          '''
          Resolves the master_ip and master_uri options
          '''
          ret = {}
      Severity: Minor
      Found in salt/minion.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 _connect_minion has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def _connect_minion(self, minion):
              '''
              Create a minion, and asynchronously connect it to a master
              '''
              auth_wait = minion.opts['acceptance_wait_time']
      Severity: Minor
      Found in salt/minion.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 __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def __init__(self, opts, timeout=60, safe=True, loaded_base_name=None, io_loop=None, jid_queue=None):  # pylint: disable=W0231
              '''
              Pass in the options dict
              '''
              # this means that the parent class doesn't know *which* master we connect to
      Severity: Minor
      Found in salt/minion.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 _load_modules has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def _load_modules(self, force_refresh=False, notify=False, grains=None, opts=None):
              '''
              Return the functions and the returners loaded up from the loader
              module
              '''
      Severity: Minor
      Found in salt/minion.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

      Cyclomatic complexity is too high in method _return_pub_multi. (21)
      Open

          def _return_pub_multi(self, rets, ret_cmd='_return', timeout=60, sync=True):
              '''
              Return the data from the executed command to the master server
              '''
              if not isinstance(rets, list):
      Severity: Minor
      Found in salt/minion.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 _target_load has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _target_load(self, load):
              # Verify that the publication is valid
              if 'tgt' not in load or 'jid' not in load or 'fun' not in load \
                 or 'arg' not in load:
                  return False
      Severity: Minor
      Found in salt/minion.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 _return_pub_syndic has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _return_pub_syndic(self, values, master_id=None):
              '''
              Wrapper to call the '_return_pub_multi' a syndic, best effort to get the one you asked for
              '''
              func = '_return_pub_multi'
      Severity: Minor
      Found in salt/minion.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 _post_master_init has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def _post_master_init(self, master):
              '''
              Function to finish init after connecting to a master
      
              This is primarily loading modules, pillars, etc. (since they need
      Severity: Minor
      Found in salt/minion.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 setup_scheduler has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def setup_scheduler(self, before_connect=False):
              '''
              Set up the scheduler.
              This is safe to call multiple times.
              '''
      Severity: Minor
      Found in salt/minion.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 _connect_syndic has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _connect_syndic(self, opts):
              '''
              Create a syndic, and asynchronously connect it to a master
              '''
              auth_wait = opts['acceptance_wait_time']
      Severity: Minor
      Found in salt/minion.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 _fire_master has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def _fire_master(self, data=None, tag=None, events=None, pretag=None, timeout=60, sync=True, timeout_handler=None):
              '''
              Fire an event on the master, or drop message if unable to send.
              '''
              load = {'id': self.opts['id'],
      Severity: Minor
      Found in salt/minion.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 setup_beacons has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def setup_beacons(self, before_connect=False):
              '''
              Set up the beacons.
              This is safe to call multiple times.
              '''
      Severity: Minor
      Found in salt/minion.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 get_proc_dir has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_proc_dir(cachedir, **kwargs):
          '''
          Given the cache directory, return the directory that process data is
          stored in, creating it if it doesn't exist.
          The following optional Keyword Arguments are handled:
      Severity: Minor
      Found in salt/minion.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 _target has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def _target(cls, minion_instance, opts, data, connected):
              if not minion_instance:
                  minion_instance = cls(opts)
                  minion_instance.connected = connected
                  if not hasattr(minion_instance, 'functions'):
      Severity: Minor
      Found in salt/minion.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 gen_modules has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def gen_modules(self, initial_load=False):
              '''
              Tell the minion to reload the execution modules
      
              CLI Example:
      Severity: Minor
      Found in salt/minion.py - About 1 hr to fix

        Function __init__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def __init__(self, opts):
                # Late setup of the opts grains, so we can log from the grains module
                import salt.loader
                opts['grains'] = salt.loader.grains(opts)
                super(SMinion, self).__init__(opts)
        Severity: Minor
        Found in salt/minion.py - About 55 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 destroy has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def destroy(self):
                '''
                Tear down the minion
                '''
                if self._running is False:
        Severity: Minor
        Found in salt/minion.py - About 55 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 eval_master_func has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

        def eval_master_func(opts):
            '''
            Evaluate master function if master type is 'func'
            and save it result in opts['master']
            '''
        Severity: Minor
        Found in salt/minion.py - About 55 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 _state_run has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def _state_run(self):
                '''
                Execute a state run based on information set in the minion config file
                '''
                if self.opts['startup_states']:
        Severity: Minor
        Found in salt/minion.py - About 55 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

        Avoid deeply nested control flow statements.
        Open

                                if retry_dns_count == 0:
                                    raise SaltMasterUnresolvableError
                                retry_dns_count -= 1
        Severity: Major
        Found in salt/minion.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if opts['master'] in opts['local_masters']:
                                      # create new list of master with the possibly failed
                                      # one moved to the end
                                      failed_master = opts['master']
                                      opts['master'] = [x for x in opts['local_masters'] if opts['master'] != x]
          Severity: Major
          Found in salt/minion.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if master_len > 1:
                                        secondary_masters = opts['master'][1:]
                                        master_idx = crc32(opts['id']) % master_len
                                        try:
                                            preferred_masters = opts['master']
            Severity: Major
            Found in salt/minion.py - About 45 mins to fix

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

                  def _call_syndic(self, func, args=(), kwargs=None, master_id=None):
                      '''
                      Wrapper to call a given func on a syndic, best effort to get the one you asked for
                      '''
                      if kwargs is None:
              Severity: Minor
              Found in salt/minion.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

              Avoid deeply nested control flow statements.
              Open

                                  for key, val in six.iteritems(string_kwarg):
                                      invalid_kwargs.append('{0}={1}'.format(key, val))
                          else:
              Severity: Major
              Found in salt/minion.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if self.opts['master_failback'] and 'master_list' in self.opts:
                                            if self.opts['master'] != self.opts['master_list'][0]:
                                                schedule = {
                                                   'function': 'status.ping_master',
                                                   'seconds': self.opts['master_failback_interval'],
                Severity: Major
                Found in salt/minion.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if not iret:
                                                  iret = []
                                              iret.append(single)
                  Severity: Major
                  Found in salt/minion.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if policy == 'any' and bool(cnt) or cnt == len(mapping):
                                                if self.opts['discovery'].get('multimaster'):
                                                    discovered.append(proto_data['master'])
                                                else:
                                                    self.opts['master'] = proto_data['master']
                    Severity: Major
                    Found in salt/minion.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if trans == 'zeromq' and not zmq:
                                                      continue
                                                  self.opts['transport'] = trans
                      Severity: Major
                      Found in salt/minion.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                    if not pub_channel.auth.authenticated:
                                                        continue
                                                    del self.opts['detect_mode']
                        Severity: Major
                        Found in salt/minion.py - About 45 mins to fix

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

                              def _handle_tag_master_connected(self, tag, data):
                                  '''
                                  Handle a master_connected event
                                  '''
                                  # handle this event only once. otherwise it will pollute the log
                          Severity: Minor
                          Found in salt/minion.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 sync_connect_master has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def sync_connect_master(self, timeout=None, failed=False):
                                  '''
                                  Block until we are connected to a master
                                  '''
                                  self._sync_connect_master_success = False
                          Severity: Minor
                          Found in salt/minion.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 _fallback_cleanups has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _fallback_cleanups(self):
                                  '''
                                  Fallback cleanup routines, attempting to fix leaked processes, threads, etc.
                                  '''
                                  # Add an extra fallback in case a forked process leaks through
                          Severity: Minor
                          Found in salt/minion.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 _forward_events has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def _forward_events(self):
                                  log.trace('Forwarding events')  # pylint: disable=no-member
                                  if self.raw_events:
                                      events = self.raw_events
                                      self.raw_events = []
                          Severity: Minor
                          Found in salt/minion.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

                          Avoid too many return statements within this function.
                          Open

                                          return False
                          Severity: Major
                          Found in salt/minion.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                    return True
                            Severity: Major
                            Found in salt/minion.py - About 30 mins to fix

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

                                  def iter_master_options(self, master_id=None):
                                      '''
                                      Iterate (in order) over your options for master
                                      '''
                                      masters = list(self._syndics.keys())
                              Severity: Minor
                              Found in salt/minion.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

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

                                          try:
                                              minion_blackout_violation = False
                                              if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                                                  whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                                                  # this minion is blacked out. Only allow saltutil.refresh_pillar and the whitelist
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 days to fix
                              salt/metaproxy/proxy.py on lines 368..491

                              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 392.

                              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

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

                                      if data['ret'] and isinstance(data['ret'], six.string_types):
                                          if 'ret_config' in data:
                                              ret['ret_config'] = data['ret_config']
                                          if 'ret_kwargs' in data:
                                              ret['ret_kwargs'] = data['ret_kwargs']
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 day to fix
                              salt/metaproxy/proxy.py on lines 534..553

                              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 210.

                              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 _target_load(self, load):
                                      # Verify that the publication is valid
                                      if 'tgt' not in load or 'jid' not in load or 'fun' not in load \
                                         or 'arg' not in load:
                                          return False
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 day to fix
                              salt/metaproxy/proxy.py on lines 780..806

                              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 206.

                              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

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

                                              if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                                                  whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                                                  # this minion is blacked out. Only allow saltutil.refresh_pillar and the whitelist
                                                  if data['fun'][ind] != 'saltutil.refresh_pillar' and data['fun'][ind] not in whitelist:
                                                      minion_blackout_violation = True
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 day to fix
                              salt/metaproxy/proxy.py on lines 601..609

                              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 186.

                              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

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

                                      if function_name in minion_instance.functions or allow_missing_funcs is True:
                                          try:
                                              minion_blackout_violation = False
                                              if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                                                  whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 day to fix
                              salt/metaproxy/proxy.py on lines 367..506

                              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 173.

                              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

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

                                              if isinstance(return_data, types.GeneratorType):
                                                  ind = 0
                                                  iret = {}
                                                  for single in return_data:
                                                      if isinstance(single, dict) and isinstance(iret, dict):
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 day to fix
                              salt/metaproxy/proxy.py on lines 413..429

                              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 160.

                              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

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

                                      if data['ret']:
                                          if 'ret_config' in data:
                                              ret['ret_config'] = data['ret_config']
                                          if 'ret_kwargs' in data:
                                              ret['ret_kwargs'] = data['ret_kwargs']
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 day to fix
                              salt/metaproxy/proxy.py on lines 659..673

                              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 150.

                              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

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

                                          if 'out' in ret:
                                              if isinstance(ret['out'], six.string_types):
                                                  load['out'] = ret['out']
                                              else:
                                                  log.error(
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 7 hrs to fix
                              salt/minion.py on lines 2019..2034

                              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 112.

                              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

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

                                      if 'out' in ret:
                                          if isinstance(ret['out'], six.string_types):
                                              load['out'] = ret['out']
                                          else:
                                              log.error(
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 7 hrs to fix
                              salt/minion.py on lines 2107..2122

                              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 112.

                              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

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

                                      if self.opts['mine_enabled'] and 'mine.update' in self.functions:
                                          self.schedule.add_job({
                                              '__mine_interval':
                                              {
                                                  'function': 'mine.update',
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 6 hrs to fix
                              salt/metaproxy/proxy.py on lines 191..205

                              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 100.

                              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

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

                                      if multiprocessing_enabled:
                                          if sys.platform.startswith('win'):
                                              # let python reconstruct the minion on the other side if we're
                                              # running on windows
                                              instance = None
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 5 hrs to fix
                              salt/metaproxy/proxy.py on lines 748..761

                              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 96.

                              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

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

                                      if process_count_max > 0:
                                          process_count = len(salt.utils.minion.running(self.opts))
                                          while process_count >= process_count_max:
                                              log.warning('Maximum number of processes (%s) reached while '
                                                          'executing jid %s, waiting %s seconds...',
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 5 hrs to fix
                              salt/metaproxy/proxy.py on lines 731..740

                              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 93.

                              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 _handle_payload(self, payload):
                                      if payload is not None and payload['enc'] == 'aes':
                                          if self._target_load(payload['load']):
                                              self._handle_decoded_payload(payload['load'])
                                          elif self.opts['zmq_filtering']:
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 5 hrs to fix
                              salt/metaproxy/proxy.py on lines 677..686

                              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 94.

                              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

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

                                      if self.jid_queue is not None:
                                          if data['jid'] in self.jid_queue:
                                              return
                                          else:
                                              self.jid_queue.append(data['jid'])
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 715..721

                              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 84.

                              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

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

                                      if self.opts['minion_sign_messages']:
                                          log.trace('Signing event to be published onto the bus.')
                                          minion_privkey_path = os.path.join(self.opts['pki_dir'], 'minion.pem')
                                          sig = salt.crypt.sign_message(minion_privkey_path, salt.serializers.msgpack.serialize(load))
                                          load['sig'] = sig
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/minion.py on lines 1446..1450

                              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 78.

                              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

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

                                      if self.opts['minion_sign_messages']:
                                          log.trace('Signing event to be published onto the bus.')
                                          minion_privkey_path = os.path.join(self.opts['pki_dir'], 'minion.pem')
                                          sig = salt.crypt.sign_message(minion_privkey_path, salt.serializers.msgpack.serialize(load))
                                          load['sig'] = sig
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/minion.py on lines 1431..1435

                              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 78.

                              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

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

                                      if isinstance(opts.get('return'), six.string_types):
                                          if data['ret']:
                                              data['ret'] = ','.join((data['ret'], opts['return']))
                                          else:
                                              data['ret'] = opts['return']
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 526..530

                              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 77.

                              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

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

                                      if isinstance(data['fun'], six.string_types):
                                          if data['fun'] == 'sys.reload_modules':
                                              self.functions, self.returners, self.function_errors, self.executors = self._load_modules()
                                              self.schedule.functions = self.functions
                                              self.schedule.returners = self.returners
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 723..727

                              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 77.

                              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

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

                                          try:
                                              minion_blackout_violation = False
                                              if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                                                  whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                                                  # this minion is blacked out. Only allow saltutil.refresh_pillar and the whitelist
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 599..648

                              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 76.

                              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

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

                                              if retcode == salt.defaults.exitcodes.EX_OK:
                                                  # No nonzero retcode in __context__ dunder. Check if return
                                                  # is a dictionary with a "result" or "success" key.
                                                  try:
                                                      func_result = all(return_data.get(x, True)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 435..445

                              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 74.

                              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

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

                                              for name in executors:
                                                  fname = '{0}.execute'.format(name)
                                                  if fname not in minion_instance.executors:
                                                      raise SaltInvocationError("Executor '{0}' is not available".format(name))
                                                  return_data = minion_instance.executors[fname](opts, data, func, args, kwargs)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 405..410

                              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 74.

                              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

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

                                              if retcode == 0:
                                                  # No nonzero retcode in __context__ dunder. Check if return
                                                  # is a dictionary with a "result" or "success" key.
                                                  try:
                                                      func_result = all(ret['return'][key].get(x, True)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 4 hrs to fix
                              salt/metaproxy/proxy.py on lines 628..638

                              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 74.

                              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

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

                                      if not self.ready:
                                          self._setup_core()
                                      elif self.connected and self.opts['pillar']:
                                          # The pillar has changed due to the connection to the master.
                                          # Reload the functions so that they can use the new pillar data.
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 hrs to fix
                              salt/metaproxy/proxy.py on lines 174..180

                              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 72.

                              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

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

                                              if minion_instance.connected and minion_instance.opts['pillar'].get('minion_blackout', False):
                                                  whitelist = minion_instance.opts['pillar'].get('minion_blackout_whitelist', [])
                                                  # this minion is blacked out. Only allow saltutil.refresh_pillar and the whitelist
                                                  if function_name != 'saltutil.refresh_pillar' and function_name not in whitelist:
                                                      minion_blackout_violation = True
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 hrs to fix
                              salt/metaproxy/proxy.py on lines 370..374

                              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 72.

                              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

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

                                      if sync:
                                          try:
                                              ret_val = self._send_req_sync(load, timeout=timeout)
                                          except SaltReqTimeoutError:
                                              timeout_handler()
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 hrs to fix
                              salt/minion.py on lines 2053..2061

                              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 71.

                              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

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

                                      if sync:
                                          try:
                                              ret_val = self._send_req_sync(load, timeout=timeout)
                                          except SaltReqTimeoutError:
                                              timeout_handler()
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 hrs to fix
                              salt/minion.py on lines 2139..2147

                              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 71.

                              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

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

                                              if minion_instance.opts['grains'].get('minion_blackout', False):
                                                  whitelist = minion_instance.opts['grains'].get('minion_blackout_whitelist', [])
                                                  if function_name != 'saltutil.refresh_pillar' and function_name not in whitelist:
                                                      minion_blackout_violation = True
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 hrs to fix
                              salt/metaproxy/proxy.py on lines 376..379

                              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 65.

                              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

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

                                      if 'user' in data:
                                          log.info(
                                              'User %s Executing command %s with jid %s',
                                              data['user'], data['fun'], data['jid']
                                          )
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 3 hrs to fix
                              salt/metaproxy/proxy.py on lines 701..709

                              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 64.

                              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

                              Identical blocks of code found in 4 locations. Consider refactoring.
                              Open

                                      if opts['multiprocessing'] and not salt.utils.platform.is_windows():
                                          # Shutdown the multiprocessing before daemonizing
                                          salt.log.setup.shutdown_multiprocessing_logging()
                              
                                          salt.utils.process.daemonize_if(opts)
                              Severity: Major
                              Found in salt/minion.py and 3 other locations - About 3 hrs to fix
                              salt/metaproxy/proxy.py on lines 341..348
                              salt/metaproxy/proxy.py on lines 564..571
                              salt/minion.py on lines 1646..1653

                              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 62.

                              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

                              Identical blocks of code found in 4 locations. Consider refactoring.
                              Open

                                      if opts['multiprocessing'] and not salt.utils.platform.is_windows():
                                          # Shutdown the multiprocessing before daemonizing
                                          salt.log.setup.shutdown_multiprocessing_logging()
                              
                                          salt.utils.process.daemonize_if(opts)
                              Severity: Major
                              Found in salt/minion.py and 3 other locations - About 3 hrs to fix
                              salt/metaproxy/proxy.py on lines 341..348
                              salt/metaproxy/proxy.py on lines 564..571
                              salt/minion.py on lines 1869..1876

                              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 62.

                              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

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

                                      if self.opts['multiprocessing']:
                                          fn_ = os.path.join(self.proc_dir, jid)
                                          if os.path.isfile(fn_):
                                              try:
                                                  os.remove(fn_)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/minion.py on lines 2076..2081

                              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 60.

                              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

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

                                          if self.opts['multiprocessing']:
                                              fn_ = os.path.join(self.proc_dir, jid)
                                              if os.path.isfile(fn_):
                                                  try:
                                                      os.remove(fn_)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/minion.py on lines 1987..1992

                              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 60.

                              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

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

                                      if multifunc_ordered:
                                          ret = {
                                              'return': [None] * num_funcs,
                                              'retcode': [None] * num_funcs,
                                              'success': [False] * num_funcs
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/metaproxy/proxy.py on lines 583..593

                              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 55.

                              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

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

                                              if isinstance(executors, six.string_types):
                                                  executors = [executors]
                                              elif not isinstance(executors, list) or not executors:
                                                  raise SaltInvocationError("Wrong executors specification: {0}. String or non-empty list expected".
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/metaproxy/proxy.py on lines 396..399

                              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 54.

                              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

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

                                          async_pillar = salt.pillar.get_async_pillar(
                                              self.opts,
                                              self.opts['grains'],
                                              self.opts['id'],
                                              self.opts['saltenv'],
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/minion.py on lines 2247..2252

                              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 54.

                              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

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

                                          async_pillar = salt.pillar.get_async_pillar(
                                              self.opts,
                                              self.opts['grains'],
                                              self.opts['id'],
                                              self.opts['saltenv'],
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/minion.py on lines 1276..1281

                              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 54.

                              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

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

                                      if 'metadata' in data:
                                          if isinstance(data['metadata'], dict):
                                              ret['metadata'] = data['metadata']
                                          else:
                                              log.warning('The metadata parameter must be a dictionary. Ignoring.')
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/metaproxy/proxy.py on lines 513..517

                              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 52.

                              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 (d_stat.st_uid != uid or d_stat.st_gid != gid) and \
                                              [i for i in (uid, gid) if i != -1]:
                                          os.chown(fn_, uid, gid)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/utils/files.py on lines 464..469

                              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 60.

                              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

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

                                          if self.opts['master_failback'] and \
                                                  'master_list' in self.opts and \
                                                  self.opts['master'] != self.opts['master_list'][0]:
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 2 hrs to fix
                              salt/metaproxy/proxy.py on lines 222..224

                              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 51.

                              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

                                      self.opts['pillar'] = salt.pillar.get_pillar(
                                          self.opts,
                                          self.opts['grains'],
                                          self.opts['id'],
                                          saltenv=self.opts['saltenv'],
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/metaproxy/proxy.py on lines 77..82

                              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 56.

                              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

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

                                      allow_missing_funcs = any([
                                          minion_instance.executors['{0}.allow_missing_func'.format(executor)](function_name)
                                          for executor in executors
                                          if '{0}.allow_missing_func' in minion_instance.executors
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/metaproxy/proxy.py on lines 362..365

                              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

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

                                          for key, value in six.iteritems(ret):
                                              if key.startswith('__'):
                                                  continue
                                              load['return'][key] = value
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/minion.py on lines 2098..2101

                              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 43.

                              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

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

                                              for key, value in six.iteritems(ret):
                                                  if key.startswith('__'):
                                                      continue
                                                  load['return'][key] = value
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/minion.py on lines 2009..2012

                              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 43.

                              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 3 locations. Consider refactoring.
                              Open

                                      ret['source_ip'] = salt.utils.network.dns_check(
                                          opts['source_address'],
                                          int(opts['source_ret_port']),
                                          True,
                                          opts['ipv6'],
                              Severity: Major
                              Found in salt/minion.py and 2 other locations - About 1 hr to fix
                              salt/minion.py on lines 149..153
                              salt/minion.py on lines 172..176

                              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 50.

                              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 3 locations. Consider refactoring.
                              Open

                                                      ret['master_ip'] = salt.utils.network.dns_check(
                                                          opts['master'],
                                                          int(opts['master_port']),
                                                          True,
                                                          opts['ipv6'],
                              Severity: Major
                              Found in salt/minion.py and 2 other locations - About 1 hr to fix
                              salt/minion.py on lines 149..153
                              salt/minion.py on lines 225..229

                              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 50.

                              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 3 locations. Consider refactoring.
                              Open

                                          ret['master_ip'] = salt.utils.network.dns_check(
                                              opts['master'],
                                              int(opts['master_port']),
                                              True,
                                              opts['ipv6'],
                              Severity: Major
                              Found in salt/minion.py and 2 other locations - About 1 hr to fix
                              salt/minion.py on lines 172..176
                              salt/minion.py on lines 225..229

                              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 50.

                              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

                              Identical blocks of code found in 3 locations. Consider refactoring.
                              Open

                                              self.schedule.add_job({
                                                  master_event(type='failback'):
                                                  {
                                                      'function': 'status.ping_master',
                                                      'seconds': self.opts['master_failback_interval'],
                              Severity: Major
                              Found in salt/minion.py and 2 other locations - About 1 hr to fix
                              salt/metaproxy/proxy.py on lines 225..233
                              salt/minion.py on lines 2575..2581

                              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 41.

                              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

                              Identical blocks of code found in 3 locations. Consider refactoring.
                              Open

                                                              schedule = {
                                                                 'function': 'status.ping_master',
                                                                 'seconds': self.opts['master_failback_interval'],
                                                                 'jid_include': True,
                                                                 'maxrunning': 1,
                              Severity: Major
                              Found in salt/minion.py and 2 other locations - About 1 hr to fix
                              salt/metaproxy/proxy.py on lines 225..233
                              salt/minion.py on lines 1339..1347

                              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 41.

                              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

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

                                      if 'cleanup' not in self.periodic_callbacks:
                                          new_periodic_callbacks['cleanup'] = tornado.ioloop.PeriodicCallback(
                                                  self._fallback_cleanups, loop_interval * 1000)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/minion.py on lines 2755..2757

                              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 40.

                              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

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

                                      if 'cleanup' not in self.periodic_callbacks:
                                          new_periodic_callbacks['cleanup'] = tornado.ioloop.PeriodicCallback(
                                                  self._fallback_cleanups, loop_interval * 1000)
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/minion.py on lines 2808..2810

                              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 40.

                              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 opts['source_ret_port']:
                                      ret['source_ret_port'] = int(opts['source_ret_port'])
                                      log.debug('Using %d as source port for the ret server', ret['source_ret_port'])
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/minion.py on lines 235..237

                              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 47.

                              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 opts['source_publish_port']:
                                      ret['source_publish_port'] = int(opts['source_publish_port'])
                                      log.debug('Using %d as source port for the master pub', ret['source_publish_port'])
                              Severity: Major
                              Found in salt/minion.py and 1 other location - About 1 hr to fix
                              salt/minion.py on lines 232..234

                              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 47.

                              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