saltstack/salt

View on GitHub
salt/modules/azurearm_compute.py

Summary

Maintainability
F
2 wks
Test Coverage

File azurearm_compute.py has 504 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Azure (ARM) Compute Execution Module

.. versionadded:: 2019.2.0
Severity: Major
Found in salt/modules/azurearm_compute.py - About 1 day to fix

    Function availability_set_create_or_update has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def availability_set_create_or_update(name, resource_group, **kwargs):  # pylint: disable=invalid-name
        '''
        .. versionadded:: 2019.2.0
    
        Create or update an availability set.
    Severity: Minor
    Found in salt/modules/azurearm_compute.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

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

    def virtual_machines_list_available_sizes(name, resource_group, **kwargs):  # pylint: disable=invalid-name
        '''
        .. versionadded:: 2019.2.0
    
        Lists all available virtual machine sizes to which the specified virtual
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 7 hrs to fix
    salt/modules/azurearm_compute.py on lines 248..284
    salt/modules/azurearm_network.py on lines 665..699
    salt/modules/azurearm_network.py on lines 1751..1785
    salt/modules/azurearm_network.py on lines 2169..2203
    salt/modules/azurearm_network.py on lines 2528..2562

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

    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 availability_sets_list_available_sizes(name, resource_group, **kwargs):  # pylint: disable=invalid-name
        '''
        .. versionadded:: 2019.2.0
    
        List all available virtual machine sizes that can be used to
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 7 hrs to fix
    salt/modules/azurearm_compute.py on lines 540..574
    salt/modules/azurearm_network.py on lines 665..699
    salt/modules/azurearm_network.py on lines 1751..1785
    salt/modules/azurearm_network.py on lines 2169..2203
    salt/modules/azurearm_network.py on lines 2528..2562

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

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

    def virtual_machines_list(resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        List all virtual machines within a resource group.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 9 other locations - About 7 hrs to fix
    salt/modules/azurearm_compute.py on lines 214..245
    salt/modules/azurearm_network.py on lines 604..634
    salt/modules/azurearm_network.py on lines 880..911
    salt/modules/azurearm_network.py on lines 1086..1117
    salt/modules/azurearm_network.py on lines 1600..1631
    salt/modules/azurearm_network.py on lines 1983..2014
    salt/modules/azurearm_network.py on lines 2331..2362
    salt/modules/azurearm_network.py on lines 2690..2721
    salt/modules/azurearm_resource.py on lines 675..703

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

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

    def availability_sets_list(resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        List all availability sets within a resource group.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 9 other locations - About 7 hrs to fix
    salt/modules/azurearm_compute.py on lines 479..509
    salt/modules/azurearm_network.py on lines 604..634
    salt/modules/azurearm_network.py on lines 880..911
    salt/modules/azurearm_network.py on lines 1086..1117
    salt/modules/azurearm_network.py on lines 1600..1631
    salt/modules/azurearm_network.py on lines 1983..2014
    salt/modules/azurearm_network.py on lines 2331..2362
    salt/modules/azurearm_network.py on lines 2690..2721
    salt/modules/azurearm_resource.py on lines 675..703

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

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

    def virtual_machines_list_all(**kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        List all virtual machines within a subscription.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 11 other locations - About 7 hrs to fix
    salt/modules/azurearm_network.py on lines 637..662
    salt/modules/azurearm_network.py on lines 853..877
    salt/modules/azurearm_network.py on lines 1059..1083
    salt/modules/azurearm_network.py on lines 1573..1597
    salt/modules/azurearm_network.py on lines 1956..1980
    salt/modules/azurearm_network.py on lines 2365..2389
    salt/modules/azurearm_network.py on lines 2724..2748
    salt/modules/azurearm_resource.py on lines 81..105
    salt/modules/azurearm_resource.py on lines 781..805
    salt/modules/azurearm_resource.py on lines 808..832
    salt/modules/azurearm_resource.py on lines 1012..1036

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

    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 virtual_machine_restart(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Restart a virtual machine.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 6 hrs to fix
    salt/modules/azurearm_compute.py on lines 376..409
    salt/modules/azurearm_compute.py on lines 412..444
    salt/modules/azurearm_compute.py on lines 577..609
    salt/modules/azurearm_compute.py on lines 647..679
    salt/modules/azurearm_compute.py on lines 682..714

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

    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 virtual_machine_power_off(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Power off (stop) a virtual machine.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 6 hrs to fix
    salt/modules/azurearm_compute.py on lines 376..409
    salt/modules/azurearm_compute.py on lines 412..444
    salt/modules/azurearm_compute.py on lines 612..644
    salt/modules/azurearm_compute.py on lines 647..679
    salt/modules/azurearm_compute.py on lines 682..714

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

    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 virtual_machine_redeploy(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Redeploy a virtual machine.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 6 hrs to fix
    salt/modules/azurearm_compute.py on lines 376..409
    salt/modules/azurearm_compute.py on lines 412..444
    salt/modules/azurearm_compute.py on lines 577..609
    salt/modules/azurearm_compute.py on lines 612..644
    salt/modules/azurearm_compute.py on lines 647..679

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

    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 virtual_machine_deallocate(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Power off a virtual machine and deallocate compute resources.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 6 hrs to fix
    salt/modules/azurearm_compute.py on lines 376..409
    salt/modules/azurearm_compute.py on lines 577..609
    salt/modules/azurearm_compute.py on lines 612..644
    salt/modules/azurearm_compute.py on lines 647..679
    salt/modules/azurearm_compute.py on lines 682..714

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

    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 virtual_machine_start(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Power on (start) a virtual machine.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 6 hrs to fix
    salt/modules/azurearm_compute.py on lines 376..409
    salt/modules/azurearm_compute.py on lines 412..444
    salt/modules/azurearm_compute.py on lines 577..609
    salt/modules/azurearm_compute.py on lines 612..644
    salt/modules/azurearm_compute.py on lines 682..714

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

    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 virtual_machine_convert_to_managed_disks(name, resource_group, **kwargs):  # pylint: disable=invalid-name
        '''
        .. versionadded:: 2019.2.0
    
        Converts virtual machine disks from blob-based to managed disks. Virtual
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 5 other locations - About 6 hrs to fix
    salt/modules/azurearm_compute.py on lines 412..444
    salt/modules/azurearm_compute.py on lines 577..609
    salt/modules/azurearm_compute.py on lines 612..644
    salt/modules/azurearm_compute.py on lines 647..679
    salt/modules/azurearm_compute.py on lines 682..714

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

    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 virtual_machine_get(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Retrieves information about the model view or the instance view of a
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 3 other locations - About 6 hrs to fix
    salt/modules/azurearm_network.py on lines 1864..1897
    salt/modules/azurearm_network.py on lines 2239..2272
    salt/modules/azurearm_network.py on lines 2598..2631

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

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

    def availability_set_get(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Get a dictionary representing an availability set's properties.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 8 other locations - About 5 hrs to fix
    salt/modules/azurearm_dns.py on lines 403..433
    salt/modules/azurearm_network.py on lines 572..601
    salt/modules/azurearm_network.py on lines 1027..1056
    salt/modules/azurearm_network.py on lines 1120..1149
    salt/modules/azurearm_network.py on lines 1418..1447
    salt/modules/azurearm_resource.py on lines 473..502
    salt/modules/azurearm_resource.py on lines 643..672
    salt/modules/azurearm_resource.py on lines 946..975

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

    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:
            av_set = compconn.availability_sets.create_or_update(
                resource_group_name=resource_group,
                availability_set_name=name,
                parameters=setmodel
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 1 other location - About 5 hrs to fix
    salt/modules/azurearm_resource.py on lines 928..939

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

    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 virtual_machine_generalize(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Set the state of a virtual machine to 'generalized'.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 1 other location - About 4 hrs to fix
    salt/modules/azurearm_compute.py on lines 148..178

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

    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 availability_set_delete(name, resource_group, **kwargs):
        '''
        .. versionadded:: 2019.2.0
    
        Delete an availability set.
    Severity: Major
    Found in salt/modules/azurearm_compute.py and 1 other location - About 4 hrs to fix
    salt/modules/azurearm_compute.py on lines 447..476

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

    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