saltstack/salt

View on GitHub
salt/states/win_dism.py

Summary

Maintainability
F
4 days
Test Coverage

File win_dism.py has 327 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Installing of Windows features using DISM
=========================================

Severity: Minor
Found in salt/states/win_dism.py - About 3 hrs to fix

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

    def package_installed(name,
                          ignore_check=False,
                          prevent_pending=False,
                          image=None,
                          restart=False):
    Severity: Minor
    Found in salt/states/win_dism.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 package_removed has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def package_removed(name, image=None, restart=False):
        '''
        Uninstall a package
    
        Args:
    Severity: Minor
    Found in salt/states/win_dism.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

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

        if '~' not in name and not os.path.exists(name):
            if __opts__['test']:
                ret['result'] = None
            else:
                ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 1 other location - About 4 hrs to fix
    salt/states/win_dism.py on lines 402..408

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

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

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

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

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

    Refactorings

    Further Reading

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

        if '~' not in name and not os.path.exists(name):
            if __opts__['test']:
                ret['result'] = None
            else:
                ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 1 other location - About 4 hrs to fix
    salt/states/win_dism.py on lines 325..331

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

    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 status['retcode'] not in [0, 1641, 3010]:
            ret['comment'] = 'Failed to remove {0}: {1}' \
                .format(name, status['stdout'])
            ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 88..91
    salt/states/win_dism.py on lines 144..147
    salt/states/win_dism.py on lines 215..218
    salt/states/win_dism.py on lines 352..355
    salt/states/win_dism.py on lines 430..433

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

        if status['retcode'] not in [0, 1641, 3010]:
            ret['comment'] = 'Failed to install {0}: {1}' \
                .format(name, status['stdout'])
            ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 88..91
    salt/states/win_dism.py on lines 144..147
    salt/states/win_dism.py on lines 215..218
    salt/states/win_dism.py on lines 275..278
    salt/states/win_dism.py on lines 430..433

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

        if status['retcode'] not in [0, 1641, 3010]:
            ret['comment'] = 'Failed to install {0}: {1}'\
                .format(name, status['stdout'])
            ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 144..147
    salt/states/win_dism.py on lines 215..218
    salt/states/win_dism.py on lines 275..278
    salt/states/win_dism.py on lines 352..355
    salt/states/win_dism.py on lines 430..433

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

        if status['retcode'] not in [0, 1641, 3010]:
            ret['comment'] = 'Failed to remove {0}: {1}' \
                .format(name, status['stdout'])
            ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 88..91
    salt/states/win_dism.py on lines 215..218
    salt/states/win_dism.py on lines 275..278
    salt/states/win_dism.py on lines 352..355
    salt/states/win_dism.py on lines 430..433

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

        if status['retcode'] not in [0, 1641, 3010]:
            ret['comment'] = 'Failed to remove {0}: {1}' \
                .format(name, status['stdout'])
            ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 88..91
    salt/states/win_dism.py on lines 144..147
    salt/states/win_dism.py on lines 215..218
    salt/states/win_dism.py on lines 275..278
    salt/states/win_dism.py on lines 352..355

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

        if status['retcode'] not in [0, 1641, 3010]:
            ret['comment'] = 'Failed to install {0}: {1}' \
                .format(name, status['stdout'])
            ret['result'] = False
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 88..91
    salt/states/win_dism.py on lines 144..147
    salt/states/win_dism.py on lines 275..278
    salt/states/win_dism.py on lines 352..355
    salt/states/win_dism.py on lines 430..433

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

        if changes:
            ret['comment'] = 'Removed {0}'.format(name)
            ret['changes'] = status
            ret['changes']['feature'] = changes
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 96..99
    salt/states/win_dism.py on lines 152..155
    salt/states/win_dism.py on lines 223..226
    salt/states/win_dism.py on lines 360..363
    salt/states/win_dism.py on lines 438..441

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

        if changes:
            ret['comment'] = 'Installed {0}'.format(name)
            ret['changes'] = status
            ret['changes']['feature'] = changes
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 96..99
    salt/states/win_dism.py on lines 152..155
    salt/states/win_dism.py on lines 283..286
    salt/states/win_dism.py on lines 360..363
    salt/states/win_dism.py on lines 438..441

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

        if changes:
            ret['comment'] = 'Removed {0}'.format(name)
            ret['changes'] = status
            ret['changes']['capability'] = changes
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 96..99
    salt/states/win_dism.py on lines 223..226
    salt/states/win_dism.py on lines 283..286
    salt/states/win_dism.py on lines 360..363
    salt/states/win_dism.py on lines 438..441

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

        if changes:
            ret['comment'] = 'Installed {0}'.format(name)
            ret['changes'] = status
            ret['changes']['package'] = changes
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 96..99
    salt/states/win_dism.py on lines 152..155
    salt/states/win_dism.py on lines 223..226
    salt/states/win_dism.py on lines 283..286
    salt/states/win_dism.py on lines 438..441

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

        if changes:
            ret['comment'] = 'Removed {0}'.format(name)
            ret['changes'] = status
            ret['changes']['package'] = changes
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 96..99
    salt/states/win_dism.py on lines 152..155
    salt/states/win_dism.py on lines 223..226
    salt/states/win_dism.py on lines 283..286
    salt/states/win_dism.py on lines 360..363

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

        if changes:
            ret['comment'] = 'Installed {0}'.format(name)
            ret['changes'] = status
            ret['changes']['capability'] = changes
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 152..155
    salt/states/win_dism.py on lines 223..226
    salt/states/win_dism.py on lines 283..286
    salt/states/win_dism.py on lines 360..363
    salt/states/win_dism.py on lines 438..441

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

        if __opts__['test']:
            ret['changes']['package'] = '{0} will be removed'.format(name)
            ret['result'] = None
            return ret
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 79..82
    salt/states/win_dism.py on lines 136..139
    salt/states/win_dism.py on lines 206..209
    salt/states/win_dism.py on lines 266..269
    salt/states/win_dism.py on lines 343..346

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

        if __opts__['test']:
            ret['changes']['feature'] = '{0} will be removed'.format(name)
            ret['result'] = None
            return ret
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 79..82
    salt/states/win_dism.py on lines 136..139
    salt/states/win_dism.py on lines 206..209
    salt/states/win_dism.py on lines 343..346
    salt/states/win_dism.py on lines 422..425

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

        if __opts__['test']:
            ret['changes']['capability'] = '{0} will be removed'.format(name)
            ret['result'] = None
            return ret
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 79..82
    salt/states/win_dism.py on lines 206..209
    salt/states/win_dism.py on lines 266..269
    salt/states/win_dism.py on lines 343..346
    salt/states/win_dism.py on lines 422..425

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

        if __opts__['test']:
            ret['changes']['package'] = '{0} will be installed'.format(name)
            ret['result'] = None
            return ret
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 79..82
    salt/states/win_dism.py on lines 136..139
    salt/states/win_dism.py on lines 206..209
    salt/states/win_dism.py on lines 266..269
    salt/states/win_dism.py on lines 422..425

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

        if __opts__['test']:
            ret['changes']['capability'] = '{0} will be installed'.format(name)
            ret['result'] = None
            return ret
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 136..139
    salt/states/win_dism.py on lines 206..209
    salt/states/win_dism.py on lines 266..269
    salt/states/win_dism.py on lines 343..346
    salt/states/win_dism.py on lines 422..425

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

        if __opts__['test']:
            ret['changes']['feature'] = '{0} will be installed'.format(name)
            ret['result'] = None
            return ret
    Severity: Major
    Found in salt/states/win_dism.py and 5 other locations - About 1 hr to fix
    salt/states/win_dism.py on lines 79..82
    salt/states/win_dism.py on lines 136..139
    salt/states/win_dism.py on lines 266..269
    salt/states/win_dism.py on lines 343..346
    salt/states/win_dism.py on lines 422..425

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 47.

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

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

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

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

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status