saltstack/salt

View on GitHub
salt/cloud/__init__.py

Summary

Maintainability
F
1 mo
Test Coverage

File __init__.py has 1962 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
The top level interface used to translate configuration data back to the
correct cloud modules
'''
Severity: Major
Found in salt/cloud/__init__.py - About 5 days to fix

    Function run_map has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_map(self, dmap):
            '''
            Execute the contents of the VM map
            '''
            if self._has_loop(dmap):
    Severity: Minor
    Found in salt/cloud/__init__.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 destroy has a Cognitive Complexity of 75 (exceeds 5 allowed). Consider refactoring.
    Open

        def destroy(self, names, cached=False):
            '''
            Destroy the named VMs
            '''
            processed = {}
    Severity: Minor
    Found in salt/cloud/__init__.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 map_data has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
    Open

        def map_data(self, cached=False):
            '''
            Create a data map of what to execute on
            '''
            ret = {'create': {}}
    Severity: Minor
    Found in salt/cloud/__init__.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 do_action has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_action(self, names, kwargs):
            '''
            Perform an action on a VM which may be specific to this cloud provider
            '''
            ret = {}
    Severity: Minor
    Found in salt/cloud/__init__.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 read has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        def read(self):
            '''
            Read in the specified map and return the map structure
            '''
            map_ = None
    Severity: Minor
    Found in salt/cloud/__init__.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 run_map. (53)
    Open

        def run_map(self, dmap):
            '''
            Execute the contents of the VM map
            '''
            if self._has_loop(dmap):
    Severity: Minor
    Found in salt/cloud/__init__.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 interpolated_map has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

        def interpolated_map(self, query='list_nodes', cached=False):
            rendered_map = self.read().copy()
            interpolated_map = {}
    
            for profile, mapped_vms in six.iteritems(rendered_map):
    Severity: Minor
    Found in salt/cloud/__init__.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

    Cyclomatic complexity is too high in method destroy. (41)
    Open

        def destroy(self, names, cached=False):
            '''
            Destroy the named VMs
            '''
            processed = {}
    Severity: Minor
    Found in salt/cloud/__init__.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 get_running_by_names has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_running_by_names(self, names, query='list_nodes', cached=False,
                                 profile=None):
            if isinstance(names, six.string_types):
                names = [names]
    
    
    Severity: Minor
    Found in salt/cloud/__init__.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 run_profile has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def run_profile(self, profile, names, vm_overrides=None):
            '''
            Parse over the options passed on the command line and determine how to
            handle them
            '''
    Severity: Minor
    Found in salt/cloud/__init__.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 _optimize_providers has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

        def _optimize_providers(self, providers):
            '''
            Return an optimized mapping of available providers
            '''
            new_providers = {}
    Severity: Minor
    Found in salt/cloud/__init__.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 create has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def create(self, vm_, local_master=True):
            '''
            Create a single VM
            '''
            output = {}
    Severity: Minor
    Found in salt/cloud/__init__.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 _has_loop has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def _has_loop(self, dmap, seen=None, val=None):
            if seen is None:
                for values in six.itervalues(dmap['create']):
                    seen = []
                    try:
    Severity: Minor
    Found in salt/cloud/__init__.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 __filter_non_working_providers has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

        def __filter_non_working_providers(self):
            '''
            Remove any mis-configured cloud providers from the available listing
            '''
            for alias, drivers in six.iteritems(self.opts['providers'].copy()):
    Severity: Minor
    Found in salt/cloud/__init__.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

    Cyclomatic complexity is too high in method create. (27)
    Open

        def create(self, vm_, local_master=True):
            '''
            Create a single VM
            '''
            output = {}
    Severity: Minor
    Found in salt/cloud/__init__.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 lookup_providers has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def lookup_providers(self, lookup):
            '''
            Get a dict describing the configured providers
            '''
            if lookup is None:
    Severity: Minor
    Found in salt/cloud/__init__.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

    Cyclomatic complexity is too high in method map_data. (26)
    Open

        def map_data(self, cached=False):
            '''
            Create a data map of what to execute on
            '''
            ret = {'create': {}}
    Severity: Minor
    Found in salt/cloud/__init__.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

    Cloud has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Cloud(object):
        '''
        An object for the creation of new VMs
        '''
        def __init__(self, opts):
    Severity: Minor
    Found in salt/cloud/__init__.py - About 2 hrs to fix

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

          def lookup_profiles(self, provider, lookup):
              '''
              Return a dictionary describing the configured profiles
              '''
              if provider is None:
      Severity: Minor
      Found in salt/cloud/__init__.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 map_providers_parallel has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def map_providers_parallel(self, query='list_nodes', cached=False):
              '''
              Return a mapping of what named VMs are running on what VM providers
              based on what providers are defined in the configuration and VMs
      
      
      Severity: Minor
      Found in salt/cloud/__init__.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

      Cyclomatic complexity is too high in method read. (23)
      Open

          def read(self):
              '''
              Read in the specified map and return the map structure
              '''
              map_ = None
      Severity: Minor
      Found in salt/cloud/__init__.py by radon

      Cyclomatic Complexity

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

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

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

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

      Cyclomatic complexity is too high in method do_action. (23)
      Open

          def do_action(self, names, kwargs):
              '''
              Perform an action on a VM which may be specific to this cloud provider
              '''
              ret = {}
      Severity: Minor
      Found in salt/cloud/__init__.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 _opts_defaults has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def _opts_defaults(self, **kwargs):
              '''
              Set the opts dict to defaults and allow for opts to be overridden in
              the kwargs
              '''
      Severity: Minor
      Found in salt/cloud/__init__.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 enter_mainloop has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      def enter_mainloop(target,
                         mapped_args=None,
                         args=None,
                         kwargs=None,
                         pool=None,
      Severity: Minor
      Found in salt/cloud/__init__.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 delete_map has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def delete_map(self, query=None):
              query_map = self.interpolated_map(query=query)
              for alias, drivers in six.iteritems(query_map.copy()):
                  for driver, vms in six.iteritems(drivers.copy()):
                      for vm_name, vm_details in six.iteritems(vms.copy()):
      Severity: Minor
      Found in salt/cloud/__init__.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_vmnames_by_action has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_vmnames_by_action(self, action):
              query_map = self.interpolated_map("list_nodes")
              matching_states = {
                  'start': ['stopped'],
                  'stop': ['running', 'active'],
      Severity: Minor
      Found in salt/cloud/__init__.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 map_providers has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def map_providers(self, query='list_nodes', cached=False):
              '''
              Return a mapping of what named VMs are running on what VM providers
              based on what providers are defined in the configuration and VMs
              '''
      Severity: Minor
      Found in salt/cloud/__init__.py - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          def __init__(self, path=None, opts=None, config_dir=None, pillars=None):
              if opts:
                  self.opts = opts
              elif path:
                  self.opts = salt.config.cloud_config(path)
      Severity: Minor
      Found in salt/cloud/__init__.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

      Consider simplifying this complex logical expression.
      Open

                          if vm_name not in names:
                              continue
      
                          elif driver == 'ec2' and 'aws' in handled_drivers and \
                                  'aws' in matches[handled_drivers['aws']] and \
      Severity: Major
      Found in salt/cloud/__init__.py - About 1 hr to fix

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

            def reboot(self, names):
                '''
                Reboot the named VMs
                '''
                ret = []
        Severity: Minor
        Found in salt/cloud/__init__.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 image_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def image_list(self, lookup='all'):
                '''
                Return a mapping of all image data for available providers
                '''
                data = {}
        Severity: Minor
        Found in salt/cloud/__init__.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            def size_list(self, lookup='all'):
                '''
                Return a mapping of all image data for available providers
                '''
                data = {}
        Severity: Minor
        Found in salt/cloud/__init__.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

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

            def location_list(self, lookup='all'):
                '''
                Return a mapping of all location data for available providers
                '''
                data = {}
        Severity: Minor
        Found in salt/cloud/__init__.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

                                if driver not in interpolated_map[alias]:
                                    interpolated_map[alias][driver] = {}
                                interpolated_map[alias][driver][vm_name] = vm_details
        Severity: Major
        Found in salt/cloud/__init__.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if 'existing' not in ret:
                                      ret['existing'] = {}
                                  ret['existing'][name] = ret['create'].pop(name)
          Severity: Major
          Found in salt/cloud/__init__.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if driver not in ret[alias]:
                                        ret[alias][driver] = {}
            
                                    # Clean kwargs of "__pub_*" data before running the cloud action call.
                                    # Prevents calling positional "kwarg" arg before "call" when no kwarg
            Severity: Major
            Found in salt/cloud/__init__.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if invalid_functions.get(fun) is None:
                                          invalid_functions.update({fun: []})
                                      invalid_functions[fun].append(vm_name)
              Severity: Major
              Found in salt/cloud/__init__.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if master_finger is not None:
                                            master_profile['master_finger'] = master_finger
                
                                # Generate the minion keys to pre-seed the master:
                                for name, profile in create_list:
                Severity: Major
                Found in salt/cloud/__init__.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if 'id' in vm_details and vm_details['id'] in names:
                                              vm_name = vm_details['id']
                                          else:
                                              log.debug(
                                                  'vm:%s in provider:%s is not in name '
                  Severity: Major
                  Found in salt/cloud/__init__.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if self.opts['parallel']:
                                                parallel_data.append({
                                                    'opts': self.opts,
                                                    'name': name,
                                                    'alias': alias,
                    Severity: Major
                    Found in salt/cloud/__init__.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if alias not in interpolated_map:
                                                  interpolated_map[alias] = {}
                                              if driver not in interpolated_map[alias]:
                      Severity: Major
                      Found in salt/cloud/__init__.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if kwargs:
                                                    ret[alias][driver][vm_name] = self.clouds[fun](
                                                        vm_name, kwargs, call='action'
                                                    )
                                                else:
                        Severity: Major
                        Found in salt/cloud/__init__.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if name not in ret['create']:
                                                      # Machine already removed
                                                      break
                          
                          
                          Severity: Major
                          Found in salt/cloud/__init__.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if not isinstance(vm_details, dict):
                                                        vm_details = {}
                                                    if 'id' in vm_details and vm_details['id'] in names:
                            Severity: Major
                            Found in salt/cloud/__init__.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if alias not in ret:
                                                          ret[alias] = {}
                                                      if driver not in ret[alias]:
                              Severity: Major
                              Found in salt/cloud/__init__.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if overrides is None or isinstance(overrides, bool):
                                                            # Foo:
                                                            #   - bar1:
                                                            #   - bar2:
                                                            overrides = {}
                                Severity: Major
                                Found in salt/cloud/__init__.py - About 45 mins to fix

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

                                      def action(
                                          self,
                                          fun=None,
                                          cloudmap=None,
                                          names=None,
                                  Severity: Minor
                                  Found in salt/cloud/__init__.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 _calcdep has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def _calcdep(self, dmap, machine, data, level):
                                          try:
                                              deplist = data['requires']
                                          except KeyError:
                                              return level
                                  Severity: Minor
                                  Found in salt/cloud/__init__.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 get_configured_providers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                      def get_configured_providers(self):
                                          '''
                                          Return the configured providers
                                          '''
                                          providers = set()
                                  Severity: Minor
                                  Found in salt/cloud/__init__.py - About 25 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

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

                                      def profile_list(self, provider, lookup='all'):
                                          '''
                                          Return a mapping of all configured profiles
                                          '''
                                          data = {}
                                  Severity: Minor
                                  Found in salt/cloud/__init__.py - About 25 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

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

                                  def communicator(func):
                                      '''Warning, this is a picklable decorator !'''
                                      def _call(queue, args, kwargs):
                                          '''called with [queue, args, kwargs] as first optional arg'''
                                          kwargs['queue'] = queue
                                  Severity: Minor
                                  Found in salt/cloud/__init__.py - About 25 mins to fix

                                  Cognitive Complexity

                                  Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                                  A method's cognitive complexity is based on a few simple rules:

                                  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                                  • Code is considered more complex for each "break in the linear flow of the code"
                                  • Code is considered more complex when "flow breaking structures are nested"

                                  Further reading

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

                                      def provider_list(self, lookup='all'):
                                          '''
                                          Return a mapping of all image data for available providers
                                          '''
                                          data = {}
                                  Severity: Minor
                                  Found in salt/cloud/__init__.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

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

                                      def size_list(self, lookup='all'):
                                          '''
                                          Return a mapping of all image data for available providers
                                          '''
                                          data = {}
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 day to fix
                                  salt/cloud/__init__.py on lines 797..834
                                  salt/cloud/__init__.py on lines 836..872

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

                                  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

                                      def location_list(self, lookup='all'):
                                          '''
                                          Return a mapping of all location data for available providers
                                          '''
                                          data = {}
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 day to fix
                                  salt/cloud/__init__.py on lines 836..872
                                  salt/cloud/__init__.py on lines 874..910

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

                                  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

                                      def image_list(self, lookup='all'):
                                          '''
                                          Return a mapping of all image data for available providers
                                          '''
                                          data = {}
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 day to fix
                                  salt/cloud/__init__.py on lines 797..834
                                  salt/cloud/__init__.py on lines 874..910

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

                                  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

                                          for name in names:
                                              vm_ = kwargs.copy()
                                              vm_['name'] = name
                                              vm_['driver'] = provider
                                  
                                  
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 4 hrs to fix
                                  salt/cloud/__init__.py on lines 457..464

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

                                  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

                                          for name in names:
                                              extra_ = kwargs.copy()
                                              extra_['name'] = name
                                              extra_['provider'] = provider
                                              extra_['profile'] = None
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 4 hrs to fix
                                  salt/cloud/__init__.py on lines 414..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 86.

                                  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 alias, driver in lookups:
                                              if alias not in data:
                                                  data[alias] = {}
                                              if driver not in data[alias]:
                                                  data[alias][driver] = {}
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 3 hrs to fix
                                  salt/cloud/__init__.py on lines 921..925

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

                                  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 alias, driver in lookups:
                                              if alias not in data:
                                                  data[alias] = {}
                                              if driver not in data[alias]:
                                                  data[alias][driver] = {}
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 3 hrs to fix
                                  salt/cloud/__init__.py on lines 938..942

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

                                  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 make_master is True and 'master_pub' not in vm_ and 'master_pem' not in vm_:
                                              log.debug('Generating the master keys for \'%s\'', vm_['name'])
                                              master_priv, master_pub = salt.utils.cloud.gen_keys(
                                                  salt.config.get_cloud_config_value(
                                                      'keysize',
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 2 hrs to fix
                                  salt/cloud/__init__.py on lines 1195..1205

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

                                  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 'pub_key' not in vm_ and 'priv_key' not in vm_:
                                                  log.debug('Generating minion keys for \'%s\'', vm_['name'])
                                                  priv, pub = salt.utils.cloud.gen_keys(
                                                      salt.config.get_cloud_config_value(
                                                          'keysize',
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 2 hrs to fix
                                  salt/cloud/__init__.py on lines 1221..1231

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

                                  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

                                          for key, val in existing_list:
                                              log.info('Calculating dependencies for %s', key)
                                              level = 0
                                              level = self._calcdep(dmap, key, val, level)
                                              log.debug('Got execution order %s for %s', level, key)
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 2 hrs to fix
                                  salt/cloud/__init__.py on lines 2040..2045

                                  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

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

                                          for key, val in six.iteritems(dmap['create']):
                                              log.info('Calculating dependencies for %s', key)
                                              level = 0
                                              level = self._calcdep(dmap, key, val, level)
                                              log.debug('Got execution order %s for %s', level, key)
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 2 hrs to fix
                                  salt/cloud/__init__.py on lines 2052..2057

                                  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

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

                                                      elif driver == 'aws' and 'ec2' in handled_drivers and \
                                                              'ec2' in matches[handled_drivers['ec2']] and \
                                                              vm_name in matches[handled_drivers['ec2']]['ec2']:
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 2 hrs to fix
                                  salt/cloud/__init__.py on lines 746..748

                                  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

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

                                                      elif driver == 'ec2' and 'aws' in handled_drivers and \
                                                              'aws' in matches[handled_drivers['aws']] and \
                                                              vm_name in matches[handled_drivers['aws']]['aws']:
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 2 hrs to fix
                                  salt/cloud/__init__.py on lines 750..752

                                  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

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

                                              if new_data:
                                                  for name, prov_data in six.iteritems(new_data):
                                                      if name not in new_providers:
                                                          new_providers[name] = {}
                                                      new_providers[name][driver] = prov_data
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 770..775
                                  salt/cloud/__init__.py on lines 782..785

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

                                  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

                                          for alias, driver in six.iteritems(providers):
                                              for name, data in six.iteritems(driver):
                                                  if name not in provider_by_driver:
                                                      provider_by_driver[name] = {}
                                  
                                  
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 782..785
                                  salt/cloud/__init__.py on lines 789..793

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

                                  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

                                                  for name, prov_data in six.iteritems(providers_data):
                                                      if name not in new_providers:
                                                          new_providers[name] = {}
                                                      new_providers[name][driver] = prov_data
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 770..775
                                  salt/cloud/__init__.py on lines 789..793

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

                                  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

                                              with salt.utils.context.func_globals_inject(
                                                  self.clouds[fun],
                                                  __active_provider_name__=':'.join([alias, driver])
                                              ):
                                                  output = self.clouds[func](vm_)
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 1019..1023

                                  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

                                                  with salt.utils.context.func_globals_inject(
                                                      self.clouds[fun],
                                                      __active_provider_name__=':'.join([alias, driver])
                                                  ):
                                                      ret = self.clouds[fun](name)
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 1257..1261

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

                                      def query(self, query_type='list_nodes'):
                                          '''
                                          Query basic instance information
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 3 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 302..308
                                  salt/cloud/__init__.py on lines 310..316
                                  salt/cloud/__init__.py on lines 318..324

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

                                      def select_query(self, query_type='list_nodes_select'):
                                          '''
                                          Query select instance information
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 3 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 294..300
                                  salt/cloud/__init__.py on lines 302..308
                                  salt/cloud/__init__.py on lines 318..324

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

                                      def min_query(self, query_type='list_nodes_min'):
                                          '''
                                          Query select instance information
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 3 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 294..300
                                  salt/cloud/__init__.py on lines 302..308
                                  salt/cloud/__init__.py on lines 310..316

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

                                      def full_query(self, query_type='list_nodes_full'):
                                          '''
                                          Query all instance information
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 3 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 294..300
                                  salt/cloud/__init__.py on lines 310..316
                                  salt/cloud/__init__.py on lines 318..324

                                  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

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

                                          if provider in providers:
                                              provider += ':{0}'.format(next(six.iterkeys(providers[provider])))
                                          else:
                                              return False
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 449..452

                                  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

                                          if provider in providers:
                                              provider += ':{0}'.format(next(six.iterkeys(providers[provider])))
                                          else:
                                              return False
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 407..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 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 2 locations. Consider refactoring.
                                  Open

                                      try:
                                          output = cloud.create(
                                              parallel_data['profile'],
                                              local_master=parallel_data['local_master']
                                          )
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 2343..2359

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

                                      try:
                                          fun = clouds['{0}.destroy'.format(parallel_data['driver'])]
                                          with salt.utils.context.func_globals_inject(
                                              fun,
                                              __active_provider_name__=':'.join([
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 1 other location - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 2313..2323

                                  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

                                          except KeyboardInterrupt as ex:
                                              trace = traceback.format_exc()
                                              queue.put('KEYBOARDINT')
                                              queue.put('Keyboard interrupt')
                                              queue.put('{0}\n{1}\n'.format(ex, trace))
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 74..78
                                  salt/cloud/__init__.py on lines 79..83

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

                                  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

                                          except SystemExit as ex:
                                              trace = traceback.format_exc()
                                              queue.put('ERROR')
                                              queue.put('System exit')
                                              queue.put('{0}\n{1}\n'.format(ex, trace))
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 69..73
                                  salt/cloud/__init__.py on lines 74..78

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

                                  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

                                          except Exception as ex:
                                              trace = traceback.format_exc()
                                              queue.put('ERROR')
                                              queue.put('Exception')
                                              queue.put('{0}\n{1}\n'.format(ex, trace))
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 69..73
                                  salt/cloud/__init__.py on lines 79..83

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

                                  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

                                      def list_locations(self, provider=None):
                                          '''
                                          List all available locations in configured cloud systems
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 267..273
                                  salt/cloud/__init__.py on lines 276..282

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

                                  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

                                      def list_images(self, provider=None):
                                          '''
                                          List all available images in configured cloud systems
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 267..273
                                  salt/cloud/__init__.py on lines 285..291

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

                                  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

                                      def list_sizes(self, provider=None):
                                          '''
                                          List all available sizes in configured cloud systems
                                          '''
                                          mapper = salt.cloud.Map(self._opts_defaults())
                                  Severity: Major
                                  Found in salt/cloud/__init__.py and 2 other locations - About 1 hr to fix
                                  salt/cloud/__init__.py on lines 276..282
                                  salt/cloud/__init__.py on lines 285..291

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

                                  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