saltstack/salt

View on GitHub
salt/modules/ebuildpkg.py

Summary

Maintainability
F
1 wk
Test Coverage

File ebuildpkg.py has 950 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Support for Portage

.. important::
Severity: Major
Found in salt/modules/ebuildpkg.py - About 2 days to fix

    Function install has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
    Open

    def install(name=None,
                refresh=False,
                pkgs=None,
                sources=None,
                slot=None,
    Severity: Minor
    Found in salt/modules/ebuildpkg.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in function install. (34)
    Open

    def install(name=None,
                refresh=False,
                pkgs=None,
                sources=None,
                slot=None,
    Severity: Minor
    Found in salt/modules/ebuildpkg.py by radon

    Cyclomatic Complexity

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

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

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

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

    Function check_extra_requirements has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_extra_requirements(pkgname, pkgver):
        '''
        Check if the installed package already has the given requirements.
    
        CLI Example:
    Severity: Minor
    Found in salt/modules/ebuildpkg.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 remove has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def remove(name=None, slot=None, fromrepo=None, pkgs=None, **kwargs):
        '''
        .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
            On minions running systemd>=205, `systemd-run(1)`_ is now used to
            isolate commands which modify installed packages from the
    Severity: Minor
    Found in salt/modules/ebuildpkg.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 refresh_db has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def refresh_db(**kwargs):
        '''
        Update the portage tree using the first available method from the following
        list:
    
    
    Severity: Minor
    Found in salt/modules/ebuildpkg.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 update has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def update(pkg, slot=None, fromrepo=None, refresh=False, binhost=None, **kwargs):
        '''
        .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
            On minions running systemd>=205, `systemd-run(1)`_ is now used to
            isolate commands which modify installed packages from the
    Severity: Minor
    Found in salt/modules/ebuildpkg.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 depclean has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def depclean(name=None, slot=None, fromrepo=None, pkgs=None):
        '''
        Portage has a function to remove unused dependencies. If a package
        is provided, it will only removed the package if no other package
        depends on it.
    Severity: Minor
    Found in salt/modules/ebuildpkg.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 check_db has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_db(*names, **kwargs):
        '''
        .. versionadded:: 0.17.0
    
        Returns a dict containing the following information for each specified
    Severity: Minor
    Found in salt/modules/ebuildpkg.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 _process_emerge_err has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _process_emerge_err(stdout, stderr):
        '''
        Used to parse emerge output to provide meaningful output when emerge fails
        '''
        ret = {}
    Severity: Minor
    Found in salt/modules/ebuildpkg.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _get_upgradable(backtrack=3):
        '''
        Utility function to get upgradable packages
    
        Sample return data:
    Severity: Minor
    Found in salt/modules/ebuildpkg.py - About 45 mins to fix

    Cognitive Complexity

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

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

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

    Further reading

    Avoid deeply nested control flow statements.
    Open

                        if verstr and verstr[0] != ':' and verstr[0] != '[':
                            prefix = prefix or '='
                            target = '{0}{1}-{2}'.format(prefix, param, verstr)
                        else:
                            target = '{0}{1}'.format(param, verstr)
    Severity: Major
    Found in salt/modules/ebuildpkg.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if latest_version(param, refresh=False) == inst_v:
                              all_uses = __salt__['portage_config.get_cleared_flags'](param)
                              if _flags_changed(*all_uses):
                                  changes[param] = {'version': inst_v,
                                                    'old': {'use': all_uses[0]},
      Severity: Major
      Found in salt/modules/ebuildpkg.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if old != new:
                                changes[param + '-USE'] = {'old': old, 'new': new}
                            target = target[:target.rfind('[')]
        Severity: Major
        Found in salt/modules/ebuildpkg.py - About 45 mins to fix

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

          def upgrade(refresh=True, binhost=None, backtrack=3, **kwargs):
              '''
              .. versionchanged:: 2015.8.12,2016.3.3,2016.11.0
                  On minions running systemd>=205, `systemd-run(1)`_ is now used to
                  isolate commands which modify installed packages from the
          Severity: Minor
          Found in salt/modules/ebuildpkg.py - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

          def latest_version(*names, **kwargs):
              '''
              Return the latest version of the named package available for upgrade or
              installation. If more than one package name is specified, a dict of
              name/version pairs is returned.
          Severity: Minor
          Found in salt/modules/ebuildpkg.py - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

          def list_pkgs(versions_as_list=False, **kwargs):
              '''
              List the packages currently installed in a dict::
          
                  {'<package_name>': '<version>'}
          Severity: Minor
          Found in salt/modules/ebuildpkg.py - About 35 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid too many return statements within this function.
          Open

                  return False
          Severity: Major
          Found in salt/modules/ebuildpkg.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return True
            Severity: Major
            Found in salt/modules/ebuildpkg.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return False
              Severity: Major
              Found in salt/modules/ebuildpkg.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return __salt__['cmd.retcode']('emerge --ask n --quiet --sync') == 0
                Severity: Major
                Found in salt/modules/ebuildpkg.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return False
                  Severity: Major
                  Found in salt/modules/ebuildpkg.py - About 30 mins to fix

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

                    def _p_to_cp(p):
                        try:
                            ret = portage.dep_getkey(p)
                            if ret:
                                return ret
                    Severity: Minor
                    Found in salt/modules/ebuildpkg.py - About 25 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

                        if name and not pkgs and (slot is not None or fromrepo is not None)and len(pkg_params) == 1:
                            fullatom = name
                            if slot is not None:
                                targets = ['{0}:{1}'.format(fullatom, slot)]
                            if fromrepo is not None:
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 day to fix
                    salt/modules/ebuildpkg.py on lines 1005..1013

                    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

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

                        if name and not pkgs and (slot is not None or fromrepo is not None)and len(pkg_params) == 1:
                            fullatom = name
                            if slot is not None:
                                targets = ['{0}:{1}'.format(fullatom, slot)]
                            if fromrepo is not None:
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 day to fix
                    salt/modules/ebuildpkg.py on lines 1138..1146

                    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

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

                        if call['retcode'] != 0:
                            msg = 'Failed to get upgrades'
                            for key in ('stderr', 'stdout'):
                                if call[key]:
                                    msg += ': ' + call[key]
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 4 hrs to fix
                    salt/modules/aptpkg.py on lines 1335..1343

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

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

                        if 'pkg.list_pkgs' in __context__:
                            if versions_as_list:
                                return __context__['pkg.list_pkgs']
                            else:
                                ret = copy.deepcopy(__context__['pkg.list_pkgs'])
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 11 other locations - About 2 hrs to fix
                    salt/modules/aixpkg.py on lines 107..114
                    salt/modules/apkpkg.py on lines 139..145
                    salt/modules/mac_brew_pkg.py on lines 117..123
                    salt/modules/mac_portspkg.py on lines 105..111
                    salt/modules/openbsdpkg.py on lines 75..81
                    salt/modules/opkg.py on lines 990..996
                    salt/modules/pacmanpkg.py on lines 211..217
                    salt/modules/pkgin.py on lines 281..287
                    salt/modules/pkgutil.py on lines 149..155
                    salt/modules/solarisipspkg.py on lines 268..274
                    salt/modules/solarispkg.py on lines 102..108

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

                    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

                        try:
                            ret = _porttree().dbapi.xmatch("match-all", p)
                            if ret:
                                return portage.cpv_getkey(ret[0])
                        except portage.exception.InvalidAtom:
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 hr to fix
                    salt/modules/portage_config.py on lines 115..119

                    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

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

                        if out['retcode'] != 0 and out['stderr']:
                            errors = [out['stderr']]
                        else:
                            errors = []
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 16 other locations - About 1 hr to fix
                    salt/modules/apkpkg.py on lines 334..337
                    salt/modules/apkpkg.py on lines 410..413
                    salt/modules/aptpkg.py on lines 810..813
                    salt/modules/freebsdpkg.py on lines 409..412
                    salt/modules/freebsdpkg.py on lines 472..475
                    salt/modules/mac_brew_pkg.py on lines 261..264
                    salt/modules/mac_brew_pkg.py on lines 415..418
                    salt/modules/openbsdpkg.py on lines 299..302
                    salt/modules/pacmanpkg.py on lines 614..617
                    salt/modules/pacmanpkg.py on lines 739..742
                    salt/modules/pkgin.py on lines 429..432
                    salt/modules/pkgin.py on lines 577..580
                    salt/modules/pkgng.py on lines 893..896
                    salt/modules/pkgng.py on lines 1070..1073
                    salt/modules/solarispkg.py on lines 466..469
                    salt/modules/yumpkg.py on lines 2018..2021

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 46.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        if call['retcode'] != 0:
                            needed_changes = _process_emerge_err(call['stdout'], call['stderr'])
                        else:
                            needed_changes = []
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 hr to fix
                    salt/modules/ebuildpkg.py on lines 845..848

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 44.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        if call['retcode'] != 0:
                            needed_changes = _process_emerge_err(call['stdout'], call['stderr'])
                        else:
                            needed_changes = []
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 hr to fix
                    salt/modules/ebuildpkg.py on lines 752..755

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 44.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        if salt.utils.systemd.has_scope(__context__) \
                                and __salt__['config.get']('systemd.scope', True):
                            cmd.extend(['systemd-run', '--scope'])
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 10 other locations - About 1 hr to fix
                    salt/modules/ebuildpkg.py on lines 740..742
                    salt/modules/ebuildpkg.py on lines 831..833
                    salt/modules/ebuildpkg.py on lines 1019..1021
                    salt/modules/kernelpkg_linux_yum.py on lines 222..224
                    salt/modules/pacmanpkg.py on lines 539..541
                    salt/modules/pacmanpkg.py on lines 680..682
                    salt/modules/pacmanpkg.py on lines 724..726
                    salt/modules/systemd_service.py on lines 1162..1164
                    salt/modules/systemd_service.py on lines 1221..1223
                    salt/modules/yumpkg.py on lines 165..166

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

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

                        if salt.utils.systemd.has_scope(__context__) \
                                and __salt__['config.get']('systemd.scope', True):
                            cmd.extend(['systemd-run', '--scope'])
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 10 other locations - About 1 hr to fix
                    salt/modules/ebuildpkg.py on lines 831..833
                    salt/modules/ebuildpkg.py on lines 923..925
                    salt/modules/ebuildpkg.py on lines 1019..1021
                    salt/modules/kernelpkg_linux_yum.py on lines 222..224
                    salt/modules/pacmanpkg.py on lines 539..541
                    salt/modules/pacmanpkg.py on lines 680..682
                    salt/modules/pacmanpkg.py on lines 724..726
                    salt/modules/systemd_service.py on lines 1162..1164
                    salt/modules/systemd_service.py on lines 1221..1223
                    salt/modules/yumpkg.py on lines 165..166

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

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

                        if salt.utils.systemd.has_scope(__context__) \
                                and __salt__['config.get']('systemd.scope', True):
                            cmd.extend(['systemd-run', '--scope'])
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 10 other locations - About 1 hr to fix
                    salt/modules/ebuildpkg.py on lines 740..742
                    salt/modules/ebuildpkg.py on lines 923..925
                    salt/modules/ebuildpkg.py on lines 1019..1021
                    salt/modules/kernelpkg_linux_yum.py on lines 222..224
                    salt/modules/pacmanpkg.py on lines 539..541
                    salt/modules/pacmanpkg.py on lines 680..682
                    salt/modules/pacmanpkg.py on lines 724..726
                    salt/modules/systemd_service.py on lines 1162..1164
                    salt/modules/systemd_service.py on lines 1221..1223
                    salt/modules/yumpkg.py on lines 165..166

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

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

                        if salt.utils.systemd.has_scope(__context__) \
                                and __salt__['config.get']('systemd.scope', True):
                            cmd.extend(['systemd-run', '--scope'])
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 10 other locations - About 1 hr to fix
                    salt/modules/ebuildpkg.py on lines 740..742
                    salt/modules/ebuildpkg.py on lines 831..833
                    salt/modules/ebuildpkg.py on lines 923..925
                    salt/modules/kernelpkg_linux_yum.py on lines 222..224
                    salt/modules/pacmanpkg.py on lines 539..541
                    salt/modules/pacmanpkg.py on lines 680..682
                    salt/modules/pacmanpkg.py on lines 724..726
                    salt/modules/systemd_service.py on lines 1162..1164
                    salt/modules/systemd_service.py on lines 1221..1223
                    salt/modules/yumpkg.py on lines 165..166

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

                    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

                        try:
                            ret = _porttree().dbapi.xmatch('bestmatch-visible', p)
                            if ret:
                                return portage.dep_getkey(ret)
                        except portage.exception.InvalidAtom:
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 hr to fix
                    salt/modules/portage_config.py on lines 108..112

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

                    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 os.path.isdir('/usr/lib/portage/pym'):
                            try:
                                # In a virtualenv, the portage python path needs to be manually added
                                sys.path.insert(0, '/usr/lib/portage/pym')
                                import portage
                    Severity: Major
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 1 hr to fix
                    salt/modules/portage_config.py on lines 28..35

                    Duplicated Code

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

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

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

                    Tuning

                    This issue has a mass of 40.

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

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

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

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

                    Refactorings

                    Further Reading

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

                        if binhost == 'try':
                            bin_opts = ['--getbinpkg']
                        elif binhost == 'force':
                            bin_opts = ['--getbinpkgonly']
                        else:
                    Severity: Minor
                    Found in salt/modules/ebuildpkg.py and 2 other locations - About 35 mins to fix
                    salt/modules/ebuildpkg.py on lines 674..679
                    salt/modules/ebuildpkg.py on lines 822..827

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                        if binhost == 'try':
                            bin_opts = ['-g']
                        elif binhost == 'force':
                            bin_opts = ['-G']
                        else:
                    Severity: Minor
                    Found in salt/modules/ebuildpkg.py and 2 other locations - About 35 mins to fix
                    salt/modules/ebuildpkg.py on lines 822..827
                    salt/modules/ebuildpkg.py on lines 914..919

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

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

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

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

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

                    Refactorings

                    Further Reading

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

                        if binhost == 'try':
                            bin_opts = ['-g']
                        elif binhost == 'force':
                            bin_opts = ['-G']
                        else:
                    Severity: Minor
                    Found in salt/modules/ebuildpkg.py and 2 other locations - About 35 mins to fix
                    salt/modules/ebuildpkg.py on lines 674..679
                    salt/modules/ebuildpkg.py on lines 914..919

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

                    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 _porttree():
                        import portage  # pylint: disable=3rd-party-module-not-gated
                        portage = salt.utils.compat.reload(portage)
                        return portage.db[portage.root]['porttree']
                    Severity: Minor
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 35 mins to fix
                    salt/modules/ebuildpkg.py on lines 70..73

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

                    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 _vartree():
                        import portage  # pylint: disable=3rd-party-module-not-gated
                        portage = salt.utils.compat.reload(portage)
                        return portage.db[portage.root]['vartree']
                    Severity: Minor
                    Found in salt/modules/ebuildpkg.py and 1 other location - About 35 mins to fix
                    salt/modules/ebuildpkg.py on lines 76..79

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

                    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