saltstack/salt

View on GitHub
salt/states/docker_container.py

Summary

Maintainability
F
2 wks
Test Coverage

File docker_container.py has 2059 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Management of Docker containers

.. versionadded:: 2017.7.0
Severity: Major
Found in salt/states/docker_container.py - About 5 days to fix

    Function running has a Cognitive Complexity of 196 (exceeds 5 allowed). Consider refactoring.
    Open

    def running(name,
                image=None,
                skip_translate=None,
                ignore_collisions=False,
                validate_ip_addrs=True,
    Severity: Minor
    Found in salt/states/docker_container.py - About 4 days 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 running. (87)
    Open

    def running(name,
                image=None,
                skip_translate=None,
                ignore_collisions=False,
                validate_ip_addrs=True,
    Severity: Minor
    Found in salt/states/docker_container.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 run has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    def run(name,
            image=None,
            onlyif=None,
            unless=None,
            creates=None,
    Severity: Minor
    Found in salt/states/docker_container.py - About 7 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 _parse_networks has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_networks(networks):
        '''
        Common logic for parsing the networks
        '''
        networks = salt.utils.args.split_input(networks or [])
    Severity: Minor
    Found in salt/states/docker_container.py - About 7 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 stopped has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def stopped(name=None,
                containers=None,
                shutdown_timeout=None,
                unpause=False,
                error_on_absent=True,
    Severity: Minor
    Found in salt/states/docker_container.py - About 5 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 mod_run_check has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    def mod_run_check(onlyif, unless, creates):
        '''
        Execute the onlyif/unless/creates logic. Returns a result dict if any of
        the checks fail, otherwise returns True
        '''
    Severity: Minor
    Found in salt/states/docker_container.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Cyclomatic complexity is too high in function run. (30)
    Open

    def run(name,
            image=None,
            onlyif=None,
            unless=None,
            creates=None,
    Severity: Minor
    Found in salt/states/docker_container.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_diff has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def _check_diff(changes):
        '''
        Check the diff for signs of incorrect argument handling in previous
        releases, as discovered here:
    
    
    Severity: Minor
    Found in salt/states/docker_container.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

    Cyclomatic complexity is too high in function stopped. (26)
    Open

    def stopped(name=None,
                containers=None,
                shutdown_timeout=None,
                unpause=False,
                error_on_absent=True,
    Severity: Minor
    Found in salt/states/docker_container.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

    Cyclomatic complexity is too high in function _parse_networks. (23)
    Open

    def _parse_networks(networks):
        '''
        Common logic for parsing the networks
        '''
        networks = salt.utils.args.split_input(networks or [])
    Severity: Minor
    Found in salt/states/docker_container.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

    Cyclomatic complexity is too high in function mod_run_check. (22)
    Open

    def mod_run_check(onlyif, unless, creates):
        '''
        Execute the onlyif/unless/creates logic. Returns a result dict if any of
        the checks fail, otherwise returns True
        '''
    Severity: Minor
    Found in salt/states/docker_container.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 absent has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def absent(name, force=False):
        '''
        Ensure that a container is absent
    
        name
    Severity: Minor
    Found in salt/states/docker_container.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 _resolve_image has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _resolve_image(ret, image, client_timeout):
        '''
        Resolve the image ID and pull the image if necessary
        '''
        image_id = __salt__['docker.resolve_image_id'](image)
    Severity: Minor
    Found in salt/states/docker_container.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

    Consider simplifying this complex logical expression.
    Open

        if not cleanup_temp and (not exists or (exists and start)) \
                or (start and cleanup_temp and pre_state != 'running'):
            if __opts__['test']:
                ret['result'] = None
                comments.append('Container would be started')
    Severity: Major
    Found in salt/states/docker_container.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if val:
                              net_changes[key] = {'old': None, 'new': val}
                              try:
                                  net_changes.pop('IPConfiguration')
                              except KeyError:
      Severity: Major
      Found in salt/states/docker_container.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if all(x == '' for x in old):
                                    return True
                            except TypeError:
        Severity: Major
        Found in salt/states/docker_container.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if val is None:
                                  errors.append(
                                      'Config option \'{0}\' for network \'{1}\' is '
                                      'missing a value'.format(key, net_name)
                                  )
          Severity: Major
          Found in salt/states/docker_container.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if disconnected:
                                            # We succeeded in disconnecting but failed
                                            # to reconnect. This can happen if the
                                            # network's subnet has changed and we try
                                            # to reconnect with the same IP address
            Severity: Major
            Found in salt/states/docker_container.py - About 45 mins to fix

              Avoid too many return statements within this function.
              Open

                      return _format_comments(ret, comments)
              Severity: Major
              Found in salt/states/docker_container.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                        return _format_comments(ret, comments)
                Severity: Major
                Found in salt/states/docker_container.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                                  return _format_comments(ret, comments)
                  Severity: Major
                  Found in salt/states/docker_container.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                    return _format_comments(ret, comments)
                    Severity: Major
                    Found in salt/states/docker_container.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return ret
                      Severity: Major
                      Found in salt/states/docker_container.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return _format_comments(ret, comments)
                        Severity: Major
                        Found in salt/states/docker_container.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return {'comment': 'All specified paths in \'creates\' '
                          Severity: Major
                          Found in salt/states/docker_container.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                                return _format_comments(ret, comments)
                            Severity: Major
                            Found in salt/states/docker_container.py - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                                          return _format_comments(ret, comments)
                              Severity: Major
                              Found in salt/states/docker_container.py - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                            return {'comment': 'creates is not a string or list of strings',
                                Severity: Major
                                Found in salt/states/docker_container.py - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return ret
                                  Severity: Major
                                  Found in salt/states/docker_container.py - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                            return ret
                                    Severity: Major
                                    Found in salt/states/docker_container.py - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                                          return ret
                                      Severity: Major
                                      Found in salt/states/docker_container.py - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                                return ret
                                        Severity: Major
                                        Found in salt/states/docker_container.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                              return ret
                                          Severity: Major
                                          Found in salt/states/docker_container.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                        return _format_comments(ret, comments)
                                            Severity: Major
                                            Found in salt/states/docker_container.py - About 30 mins to fix

                                              Avoid too many return statements within this function.
                                              Open

                                                  return _format_comments(ret, comments)
                                              Severity: Major
                                              Found in salt/states/docker_container.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

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

                                                  Avoid too many return statements within this function.
                                                  Open

                                                                  return _format_comments(ret, comments)
                                                  Severity: Major
                                                  Found in salt/states/docker_container.py - About 30 mins to fix

                                                    Avoid too many return statements within this function.
                                                    Open

                                                                return ret
                                                    Severity: Major
                                                    Found in salt/states/docker_container.py - About 30 mins to fix

                                                      Avoid too many return statements within this function.
                                                      Open

                                                              return _format_comments(ret, comments)
                                                      Severity: Major
                                                      Found in salt/states/docker_container.py - About 30 mins to fix

                                                        Avoid too many return statements within this function.
                                                        Open

                                                                return ret
                                                        Severity: Major
                                                        Found in salt/states/docker_container.py - About 30 mins to fix

                                                          Avoid too many return statements within this function.
                                                          Open

                                                              return ret
                                                          Severity: Major
                                                          Found in salt/states/docker_container.py - About 30 mins to fix

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

                                                            def mod_watch(name, sfun=None, **kwargs):
                                                                '''
                                                                The docker_container watcher, called to invoke the watch command.
                                                            
                                                                .. note::
                                                            Severity: Minor
                                                            Found in salt/states/docker_container.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 image is None:
                                                                    ret['result'] = False
                                                                    ret['comment'] = 'The \'image\' argument is required'
                                                                    return ret
                                                                elif not isinstance(image, six.string_types):
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 1 other location - About 3 hrs to fix
                                                            salt/states/docker_container.py on lines 1683..1688

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

                                                            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 image is None:
                                                                    ret['result'] = False
                                                                    ret['comment'] = 'The \'image\' argument is required'
                                                                    return ret
                                                                elif not isinstance(image, six.string_types):
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 1 other location - About 3 hrs to fix
                                                            salt/states/docker_container.py on lines 2219..2224

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

                                                            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:
                                                                    # Since we're rewriting the "networks" value below, save the original
                                                                    # value here.
                                                                    configured_networks = networks
                                                                    networks = _parse_networks(networks)
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 1 other location - About 2 hrs to fix
                                                            salt/states/docker_container.py on lines 2231..2241

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

                                                            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:
                                                                    if 'networks' in kwargs and kwargs['networks'] is not None:
                                                                        kwargs['networks'] = _parse_networks(kwargs['networks'])
                                                                    _resolve_image(ret, image, client_timeout)
                                                                except CommandExecutionError as exc:
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 1 other location - About 2 hrs to fix
                                                            salt/states/docker_container.py on lines 1690..1704

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

                                                            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 not isinstance(onlyif, list) \
                                                                            or not all(isinstance(x, six.string_types) for x in onlyif):
                                                                        return {'comment': 'onlyif is not a string or list of strings',
                                                                                'skip_watch': True,
                                                                                'result': True}
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 2 other locations - About 1 hr to fix
                                                            salt/states/docker_container.py on lines 2583..2587
                                                            salt/states/docker_container.py on lines 2604..2608

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

                                                            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 not isinstance(creates, list) \
                                                                            or not all(isinstance(x, six.string_types) for x in creates):
                                                                        return {'comment': 'creates is not a string or list of strings',
                                                                                'skip_watch': True,
                                                                                'result': True}
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 2 other locations - About 1 hr to fix
                                                            salt/states/docker_container.py on lines 2562..2566
                                                            salt/states/docker_container.py on lines 2583..2587

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

                                                            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 not isinstance(unless, list) \
                                                                            or not all(isinstance(x, six.string_types) for x in unless):
                                                                        return {'comment': 'unless is not a string or list of strings',
                                                                                'skip_watch': True,
                                                                                'result': True}
                                                            Severity: Major
                                                            Found in salt/states/docker_container.py and 2 other locations - About 1 hr to fix
                                                            salt/states/docker_container.py on lines 2562..2566
                                                            salt/states/docker_container.py on lines 2604..2608

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

                                                            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 isinstance(comments, six.string_types):
                                                                    ret['comment'] = comments
                                                                else:
                                                                    ret['comment'] = '. '.join(comments)
                                                                    if len(comments) > 1:
                                                            Severity: Minor
                                                            Found in salt/states/docker_container.py and 1 other location - About 55 mins to fix
                                                            salt/states/debconfmod.py on lines 85..155

                                                            Duplicated Code

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

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

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

                                                            Tuning

                                                            This issue has a mass of 45.

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

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

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

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

                                                            Refactorings

                                                            Further Reading

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

                                                                for unsupported in ('watch_action', 'start', 'shutdown_timeout', 'follow'):
                                                                    if unsupported in kwargs:
                                                                        ret['result'] = False
                                                                        ret['comment'] = 'The \'{0}\' argument is not supported'.format(
                                                                            unsupported
                                                            Severity: Minor
                                                            Found in salt/states/docker_container.py and 2 other locations - About 35 mins to fix
                                                            salt/modules/schedule.py on lines 467..470
                                                            salt/states/powerpath.py on lines 39..42

                                                            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

                                                                except KeyError as exc:
                                                                    ret['result'] = False
                                                                    comments.append(
                                                                        'Key \'{0}\' missing from API response, this may be due to a '
                                                                        'change in the Docker Remote API. Please report this on the '
                                                            Severity: Minor
                                                            Found in salt/states/docker_container.py and 1 other location - About 30 mins to fix
                                                            salt/states/docker_container.py on lines 1905..1912

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

                                                                                    try:
                                                                                        __salt__['docker.signal'](name, signal=watch_action)
                                                                                    except CommandExecutionError as exc:
                                                                                        ret['result'] = False
                                                                                        comments.append(
                                                            Severity: Minor
                                                            Found in salt/states/docker_container.py and 1 other location - About 30 mins to fix
                                                            salt/states/docker_container.py on lines 1760..1768

                                                            Duplicated Code

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

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

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

                                                            Tuning

                                                            This issue has a mass of 40.

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

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

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

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

                                                            Refactorings

                                                            Further Reading

                                                            There are no issues that match your filters.

                                                            Category
                                                            Status