saltstack/salt

View on GitHub
salt/cloud/clouds/softlayer.py

Summary

Maintainability
F
1 wk
Test Coverage

File softlayer.py has 538 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
SoftLayer Cloud Module
======================

Severity: Major
Found in salt/cloud/clouds/softlayer.py - About 1 day to fix

    Function create has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

    def create(vm_):
        '''
        Create a single VM from a data dict
        '''
        try:
    Severity: Minor
    Found in salt/cloud/clouds/softlayer.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 function create. (34)
    Open

    def create(vm_):
        '''
        Create a single VM from a data dict
        '''
        try:
    Severity: Minor
    Found in salt/cloud/clouds/softlayer.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 create has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def create(vm_):
        '''
        Create a single VM from a data dict
        '''
        try:
    Severity: Major
    Found in salt/cloud/clouds/softlayer.py - About 2 hrs to fix

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

      def list_nodes(call=None):
          '''
          Return a list of the VMs that are on the provider
          '''
          if call == 'action':
      Severity: Minor
      Found in salt/cloud/clouds/softlayer.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 list_custom_images has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def list_custom_images(call=None):
          '''
          Return a dict of all custom VM images on the cloud provider.
          '''
          if call != 'function':
      Severity: Minor
      Found in salt/cloud/clouds/softlayer.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 2 locations. Consider refactoring.
      Open

          for processors in response['processors']:
              ret['processors'][processors['itemPrice']['item']['description']] = {
                  'name': processors['itemPrice']['item']['description'],
                  'start cpus': processors['template']['startCpus'],
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 4 hrs to fix
      salt/cloud/clouds/softlayer.py on lines 166..169

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

      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 memory in response['memory']:
              ret['memory'][memory['itemPrice']['item']['description']] = {
                  'name': memory['itemPrice']['item']['description'],
                  'maxMemory': memory['template']['maxMemory'],
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 4 hrs to fix
      salt/cloud/clouds/softlayer.py on lines 171..174

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

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

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

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

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

      Refactorings

      Further Reading

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

          __utils__['cloud.fire_event'](
              'event',
              'requesting instance',
              'salt/cloud/{0}/requesting'.format(name),
              args={
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 2 other locations - About 3 hrs to fix
      salt/cloud/clouds/libvirt.py on lines 351..359
      salt/cloud/clouds/softlayer_hw.py on lines 324..332

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

      def show_instance(name, call=None):
          '''
          Show the details from SoftLayer concerning a guest
          '''
          if call != 'action':
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 5 other locations - About 2 hrs to fix
      salt/cloud/clouds/oneandone.py on lines 578..593
      salt/cloud/clouds/profitbricks.py on lines 661..676
      salt/cloud/clouds/proxmox.py on lines 1045..1056
      salt/cloud/clouds/softlayer_hw.py on lines 488..499
      salt/cloud/libcloudfuncs.py on lines 505..516

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

      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 private_security_groups:
              secgroups = [{'securityGroup': {'id': int(sg)}}
                           for sg in private_security_groups]
              pbnc = kwargs.get('primaryBackendNetworkComponent', {})
              pbnc['securityGroupBindings'] = secgroups
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 2 hrs to fix
      salt/cloud/clouds/softlayer.py on lines 363..368

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 65.

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

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

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

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

      Refactorings

      Further Reading

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

          if public_security_groups:
              secgroups = [{'securityGroup': {'id': int(sg)}}
                           for sg in public_security_groups]
              pnc = kwargs.get('primaryNetworkComponent', {})
              pnc['securityGroupBindings'] = secgroups
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 2 hrs to fix
      salt/cloud/clouds/softlayer.py on lines 374..379

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 65.

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

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

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

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

      Refactorings

      Further Reading

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

      def get_conn(service='SoftLayer_Virtual_Guest'):
          '''
          Return a conn object for the passed VM data
          '''
          client = SoftLayer.Client(
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 2 hrs to fix
      salt/cloud/clouds/softlayer_hw.py on lines 102..114

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

          __utils__['cloud.fire_event'](
              'event',
              'starting create',
              'salt/cloud/{0}/creating'.format(name),
              args=__utils__['cloud.filter_event']('creating', vm_, ['name', 'profile', 'provider', 'driver']),
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 10 other locations - About 2 hrs to fix
      salt/cloud/clouds/libvirt.py on lines 309..315
      salt/cloud/clouds/libvirt.py on lines 459..465
      salt/cloud/clouds/linode.py on lines 341..347
      salt/cloud/clouds/linode.py on lines 430..436
      salt/cloud/clouds/linode.py on lines 528..534
      salt/cloud/clouds/packet.py on lines 334..340
      salt/cloud/clouds/packet.py on lines 426..432
      salt/cloud/clouds/softlayer.py on lines 514..520
      salt/cloud/clouds/softlayer_hw.py on lines 240..246
      salt/cloud/clouds/softlayer_hw.py on lines 416..422

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 60.

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

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

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

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

      Refactorings

      Further Reading

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

          __utils__['cloud.fire_event'](
              'event',
              'created instance',
              'salt/cloud/{0}/created'.format(name),
              args=__utils__['cloud.filter_event']('created', vm_, ['name', 'profile', 'provider', 'driver']),
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 10 other locations - About 2 hrs to fix
      salt/cloud/clouds/libvirt.py on lines 309..315
      salt/cloud/clouds/libvirt.py on lines 459..465
      salt/cloud/clouds/linode.py on lines 341..347
      salt/cloud/clouds/linode.py on lines 430..436
      salt/cloud/clouds/linode.py on lines 528..534
      salt/cloud/clouds/packet.py on lines 334..340
      salt/cloud/clouds/packet.py on lines 426..432
      salt/cloud/clouds/softlayer.py on lines 272..278
      salt/cloud/clouds/softlayer_hw.py on lines 240..246
      salt/cloud/clouds/softlayer_hw.py on lines 416..422

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 60.

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

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

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

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

      Refactorings

      Further Reading

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

      def script(vm_):
          '''
          Return the script deployment object
          '''
          deploy_script = salt.utils.cloud.os_script(
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 4 other locations - About 2 hrs to fix
      salt/cloud/clouds/aliyun.py on lines 835..847
      salt/cloud/clouds/digitalocean.py on lines 607..619
      salt/cloud/clouds/qingcloud.py on lines 750..763
      salt/cloud/clouds/softlayer_hw.py on lines 87..99

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

      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 node['id'] == response['id'] and \
                                  'passwords' in node['operatingSystem'] and \
                                  node['operatingSystem']['passwords']:
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 1 hr to fix
      salt/cloud/clouds/softlayer_hw.py on lines 391..393

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

          try:
              # Check for required profile parameters before sending any API calls.
              if vm_['profile'] and config.is_profile_configured(__opts__,
                                                                 __active_provider_name__ or 'softlayer',
                                                                 vm_['profile'],
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 17 other locations - About 1 hr to fix
      salt/cloud/clouds/aliyun.py on lines 615..622
      salt/cloud/clouds/azurearm.py on lines 1384..1392
      salt/cloud/clouds/cloudstack.py on lines 270..277
      salt/cloud/clouds/digitalocean.py on lines 277..284
      salt/cloud/clouds/ec2.py on lines 2554..2561
      salt/cloud/clouds/gce.py on lines 2451..2458
      salt/cloud/clouds/gogrid.py on lines 86..93
      salt/cloud/clouds/joyent.py on lines 260..267
      salt/cloud/clouds/linode.py on lines 328..335
      salt/cloud/clouds/msazure.py on lines 419..426
      salt/cloud/clouds/nova.py on lines 938..945
      salt/cloud/clouds/parallels.py on lines 277..284
      salt/cloud/clouds/proxmox.py on lines 566..573
      salt/cloud/clouds/qingcloud.py on lines 658..665
      salt/cloud/clouds/scaleway.py on lines 190..197
      salt/cloud/clouds/softlayer_hw.py on lines 216..223
      salt/cloud/clouds/vmware.py on lines 2532..2540

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 55.

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

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

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

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

      Refactorings

      Further Reading

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

              ret[node] = {
                  'id': nodes[node]['hostname'],
                  'ram': nodes[node]['maxMemory'],
                  'cpus': nodes[node]['maxCpu'],
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 1 hr to fix
      salt/cloud/clouds/softlayer_hw.py on lines 467..470

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 55.

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

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

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

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

      Refactorings

      Further Reading

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

      def list_vlans(call=None):
          '''
          List all VLANs associated with the account
          '''
          if call != 'function':
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 1 hr to fix
      salt/cloud/clouds/softlayer_hw.py on lines 553..563

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

      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

      def get_location(vm_=None):
          '''
          Return the location to use, in this order:
              - CLI parameter
              - VM parameter
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 1 other location - About 1 hr to fix
      salt/cloud/clouds/softlayer_hw.py on lines 193..205

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 40.

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

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

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

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

      Refactorings

      Further Reading

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

          if 'error' in nodes:
              raise SaltCloudSystemExit(
                  'An error occurred while listing nodes: {0}'.format(
                      nodes['error']['Errors']['Error']['Message']
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 5 other locations - About 1 hr to fix
      salt/cloud/clouds/ec2.py on lines 3629..3632
      salt/cloud/clouds/ec2.py on lines 3660..3663
      salt/cloud/clouds/ec2.py on lines 3692..3695
      salt/cloud/clouds/softlayer_hw.py on lines 460..463
      salt/utils/cloud.py on lines 2572..2575

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 47.

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

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

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

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

      Refactorings

      Further Reading

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

              if 'primaryIpAddress' in nodes[node]:
                  ret[node]['public_ips'] = nodes[node]['primaryIpAddress']
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 3 other locations - About 55 mins to fix
      salt/cloud/clouds/softlayer.py on lines 570..571
      salt/cloud/clouds/softlayer_hw.py on lines 472..473
      salt/cloud/clouds/softlayer_hw.py on lines 474..475

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 45.

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

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

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

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

      Refactorings

      Further Reading

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

              if 'primaryBackendIpAddress' in nodes[node]:
                  ret[node]['private_ips'] = nodes[node]['primaryBackendIpAddress']
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 3 other locations - About 55 mins to fix
      salt/cloud/clouds/softlayer.py on lines 568..569
      salt/cloud/clouds/softlayer_hw.py on lines 472..473
      salt/cloud/clouds/softlayer_hw.py on lines 474..475

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 45.

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

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

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

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

      Refactorings

      Further Reading

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

          if __opts__.get('update_cachedir', False) is True:
              __utils__['cloud.delete_minion_cachedir'](name, __active_provider_name__.split(':')[0], __opts__)
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 22 other locations - About 50 mins to fix
      salt/cloud/clouds/azurearm.py on lines 1528..1532
      salt/cloud/clouds/digitalocean.py on lines 868..869
      salt/cloud/clouds/ec2.py on lines 3417..3418
      salt/cloud/clouds/gce.py on lines 2377..2378
      salt/cloud/clouds/gogrid.py on lines 421..422
      salt/cloud/clouds/joyent.py on lines 429..430
      salt/cloud/clouds/linode.py on lines 758..759
      salt/cloud/clouds/lxc.py on lines 415..416
      salt/cloud/clouds/msazure.py on lines 947..948
      salt/cloud/clouds/nova.py on lines 569..570
      salt/cloud/clouds/oneandone.py on lines 918..922
      salt/cloud/clouds/opennebula.py on lines 1226..1230
      salt/cloud/clouds/openstack.py on lines 816..817
      salt/cloud/clouds/parallels.py on lines 561..562
      salt/cloud/clouds/profitbricks.py on lines 1023..1027
      salt/cloud/clouds/proxmox.py on lines 1194..1196
      salt/cloud/clouds/scaleway.py on lines 456..458
      salt/cloud/clouds/softlayer_hw.py on lines 547..548
      salt/cloud/clouds/vagrant.py on lines 308..310
      salt/cloud/clouds/vmware.py on lines 2513..2514
      salt/cloud/clouds/xen.py on lines 1046..1050
      salt/cloud/libcloudfuncs.py on lines 403..404

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

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

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

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

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

      Refactorings

      Further Reading

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

              ret[image['name']] = {
                  'id': image['id'],
                  'name': image['name'],
                  'globalIdentifier': image['globalIdentifier'],
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 2 other locations - About 45 mins to fix
      salt/cloud/clouds/softlayer_hw.py on lines 131..135
      salt/modules/xapi_virt.py on lines 371..374

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 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 15 locations. Consider refactoring.
      Open

      def __virtual__():
          '''
          Check for SoftLayer configurations.
          '''
          if get_configured_provider() is False:
      Severity: Major
      Found in salt/cloud/clouds/softlayer.py and 14 other locations - About 30 mins to fix
      salt/cloud/clouds/aliyun.py on lines 90..100
      salt/cloud/clouds/cloudstack.py on lines 78..88
      salt/cloud/clouds/digitalocean.py on lines 68..78
      salt/cloud/clouds/ec2.py on lines 186..196
      salt/cloud/clouds/msazure.py on lines 79..89
      salt/cloud/clouds/oneandone.py on lines 156..166
      salt/cloud/clouds/opennebula.py on lines 98..108
      salt/cloud/clouds/openstack.py on lines 248..256
      salt/cloud/clouds/profitbricks.py on lines 138..148
      salt/cloud/clouds/proxmox.py on lines 70..80
      salt/cloud/clouds/pyrax.py on lines 29..39
      salt/cloud/clouds/qingcloud.py on lines 71..81
      salt/cloud/clouds/softlayer_hw.py on lines 53..63
      salt/cloud/clouds/vmware.py on lines 173..183

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 40.

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

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

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

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

      Refactorings

      Further Reading

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

          try:
              response = conn.createObject(kwargs)
          except Exception as exc:
              log.error(
                  'Error creating %s on SoftLayer\n\n'
      Severity: Minor
      Found in salt/cloud/clouds/softlayer.py and 2 other locations - About 30 mins to fix
      salt/cloud/clouds/gce.py on lines 1915..1922
      salt/cloud/clouds/softlayer_hw.py on lines 335..347

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 40.

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

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

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

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

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status