saltstack/salt

View on GitHub
salt/modules/rbac_solaris.py

Summary

Maintainability
F
1 wk
Test Coverage

File rbac_solaris.py has 446 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Module for Solaris' Role-Based Access Control
'''
from __future__ import absolute_import, unicode_literals, print_function
Severity: Minor
Found in salt/modules/rbac_solaris.py - About 6 hrs to fix

    Function auth_get has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def auth_get(user, computed=True):
        '''
        List authorization for user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function profile_get has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def profile_get(user, default_hidden=True):
        '''
        List profiles for user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def role_get(user):
        '''
        List roles for user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function auth_add has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def auth_add(user, auth):
        '''
        Add authorization to user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function role_list has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def role_list():
        '''
        List all available roles
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function auth_rm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def auth_rm(user, auth):
        '''
        Remove authorization from user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function profile_rm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def profile_rm(user, profile):
        '''
        Remove profile from user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function role_rm has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def role_rm(user, role):
        '''
        Remove role from user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function role_add has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def role_add(user, role):
        '''
        Add role to user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function profile_add has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def profile_add(user, profile):
        '''
        Add profile to user
    
        user : string
    Severity: Minor
    Found in salt/modules/rbac_solaris.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def profile_list(default_only=False):
        '''
        List all available profiles
    
        default_only : boolean
    Severity: Minor
    Found in salt/modules/rbac_solaris.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

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

        with salt.utils.files.fopen('/etc/user_attr', 'r') as user_attr:
            for auth in user_attr:
                auth = salt.utils.stringutils.to_unicode(auth)
                auth = auth.strip().split(':')
    
    
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 1 other location - About 1 day to fix
    salt/modules/rbac_solaris.py on lines 98..120

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

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

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

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

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

    Refactorings

    Further Reading

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

        with salt.utils.files.fopen('/etc/user_attr', 'r') as user_attr:
            for profile in user_attr:
                profile = salt.utils.stringutils.to_unicode(profile)
                profile = profile.strip().split(':')
    
    
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 1 other location - About 1 day to fix
    salt/modules/rbac_solaris.py on lines 482..504

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

    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 valid_profiles:
            res = __salt__['cmd.run_all']('usermod -P "{profiles}" {login}'.format(
                login=user,
                profiles=','.join([p for p in profile_get(user) if p not in valid_profiles]),
            ))
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 1 other location - About 7 hrs to fix
    salt/modules/rbac_solaris.py on lines 409..419

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

    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 valid_roles:
            res = __salt__['cmd.run_all']('usermod -R "{roles}" {login}'.format(
                login=user,
                roles=','.join([r for r in role_get(user) if r not in valid_roles]),
            ))
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 1 other location - About 7 hrs to fix
    salt/modules/rbac_solaris.py on lines 216..226

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

    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 valid_roles:
            res = __salt__['cmd.run_all']('usermod -R "{roles}" {login}'.format(
                login=user,
                roles=','.join(set(role_get(user) + valid_roles)),
            ))
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 1 other location - About 6 hrs to fix
    salt/modules/rbac_solaris.py on lines 161..171

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

    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 valid_profiles:
            res = __salt__['cmd.run_all']('usermod -P "{profiles}" {login}'.format(
                login=user,
                profiles=','.join(set(profile_get(user) + valid_profiles)),
            ))
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 1 other location - About 6 hrs to fix
    salt/modules/rbac_solaris.py on lines 354..364

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

    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

        for p in profiles:
            if p not in valid_profiles:
                ret[p] = 'Unknown'
            elif p in active_profiles:
                ret[p] = 'Added'
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 5 other locations - About 2 hrs to fix
    salt/modules/rbac_solaris.py on lines 230..236
    salt/modules/rbac_solaris.py on lines 368..374
    salt/modules/rbac_solaris.py on lines 423..429
    salt/modules/rbac_solaris.py on lines 563..569
    salt/modules/rbac_solaris.py on lines 618..624

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

    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

        for a in auths:
            if a not in valid_auths:
                ret[a] = 'Unknown'
            elif a in active_auths:
                ret[a] = 'Added'
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 5 other locations - About 2 hrs to fix
    salt/modules/rbac_solaris.py on lines 175..181
    salt/modules/rbac_solaris.py on lines 230..236
    salt/modules/rbac_solaris.py on lines 368..374
    salt/modules/rbac_solaris.py on lines 423..429
    salt/modules/rbac_solaris.py on lines 618..624

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

    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

        for r in roles:
            if r not in valid_roles:
                ret[r] = 'Unknown'
            elif r in active_roles:
                ret[r] = 'Failed'
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 5 other locations - About 2 hrs to fix
    salt/modules/rbac_solaris.py on lines 175..181
    salt/modules/rbac_solaris.py on lines 230..236
    salt/modules/rbac_solaris.py on lines 368..374
    salt/modules/rbac_solaris.py on lines 563..569
    salt/modules/rbac_solaris.py on lines 618..624

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

    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

        for a in auths:
            if a not in valid_auths:
                ret[a] = 'Unknown'
            elif a in active_auths:
                ret[a] = 'Failed'
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 5 other locations - About 2 hrs to fix
    salt/modules/rbac_solaris.py on lines 175..181
    salt/modules/rbac_solaris.py on lines 230..236
    salt/modules/rbac_solaris.py on lines 368..374
    salt/modules/rbac_solaris.py on lines 423..429
    salt/modules/rbac_solaris.py on lines 563..569

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

    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

        for p in profiles:
            if p not in valid_profiles:
                ret[p] = 'Unknown'
            elif p in active_profiles:
                ret[p] = 'Failed'
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 5 other locations - About 2 hrs to fix
    salt/modules/rbac_solaris.py on lines 175..181
    salt/modules/rbac_solaris.py on lines 368..374
    salt/modules/rbac_solaris.py on lines 423..429
    salt/modules/rbac_solaris.py on lines 563..569
    salt/modules/rbac_solaris.py on lines 618..624

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

    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

        for r in roles:
            if r not in valid_roles:
                ret[r] = 'Unknown'
            elif r in active_roles:
                ret[r] = 'Added'
    Severity: Major
    Found in salt/modules/rbac_solaris.py and 5 other locations - About 2 hrs to fix
    salt/modules/rbac_solaris.py on lines 175..181
    salt/modules/rbac_solaris.py on lines 230..236
    salt/modules/rbac_solaris.py on lines 423..429
    salt/modules/rbac_solaris.py on lines 563..569
    salt/modules/rbac_solaris.py on lines 618..624

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

    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