saltstack/salt

View on GitHub
salt/states/file.py

Summary

Maintainability
F
3 mos
Test Coverage

File file.py has 6757 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
Operations on regular files, special files, directories, and symlinks
=====================================================================

Severity: Major
Found in salt/states/file.py - About 2 wks to fix

    Function _check_directory_win has a Cognitive Complexity of 204 (exceeds 5 allowed). Consider refactoring.
    Open

    def _check_directory_win(name,
                             win_owner=None,
                             win_perms=None,
                             win_deny_perms=None,
                             win_inheritance=None,
    Severity: Minor
    Found in salt/states/file.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

    Function directory has a Cognitive Complexity of 188 (exceeds 5 allowed). Consider refactoring.
    Open

    def directory(name,
                  user=None,
                  group=None,
                  recurse=None,
                  max_depth=None,
    Severity: Minor
    Found in salt/states/file.py - About 3 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

    Function managed has a Cognitive Complexity of 178 (exceeds 5 allowed). Consider refactoring.
    Open

    def managed(name,
                source=None,
                source_hash='',
                source_hash_name=None,
                keep_source=True,
    Severity: Minor
    Found in salt/states/file.py - About 3 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

    Function symlink has a Cognitive Complexity of 151 (exceeds 5 allowed). Consider refactoring.
    Open

    def symlink(
            name,
            target,
            force=False,
            backupname=None,
    Severity: Minor
    Found in salt/states/file.py - About 3 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

    Function keyvalue has a Cognitive Complexity of 134 (exceeds 5 allowed). Consider refactoring.
    Open

    def keyvalue(
            name,
            key=None,
            value=None,
            key_values=None,
    Severity: Minor
    Found in salt/states/file.py - About 2 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 managed. (106)
    Open

    def managed(name,
                source=None,
                source_hash='',
                source_hash_name=None,
                keep_source=True,
    Severity: Minor
    Found in salt/states/file.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 patch has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
    Open

    def patch(name,
              source=None,
              source_hash=None,
              source_hash_name=None,
              skip_verify=False,
    Severity: Minor
    Found in salt/states/file.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

    Function _check_directory has a Cognitive Complexity of 87 (exceeds 5 allowed). Consider refactoring.
    Open

    def _check_directory(name,
                         user=None,
                         group=None,
                         recurse=False,
                         mode=None,
    Severity: Minor
    Found in salt/states/file.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

    Function shortcut has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

    def shortcut(
            name,
            target,
            arguments=None,
            working_dir=None,
    Severity: Minor
    Found in salt/states/file.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

    Function recurse has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

    def recurse(name,
                source,
                keep_source=True,
                clean=False,
                require=None,
    Severity: Minor
    Found in salt/states/file.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 directory. (85)
    Open

    def directory(name,
                  user=None,
                  group=None,
                  recurse=None,
                  max_depth=None,
    Severity: Minor
    Found in salt/states/file.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 prepend has a Cognitive Complexity of 61 (exceeds 5 allowed). Consider refactoring.
    Open

    def prepend(name,
                text=None,
                makedirs=False,
                source=None,
                source_hash=None,
    Severity: Minor
    Found in salt/states/file.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

    Function _gen_keep_files has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring.
    Open

    def _gen_keep_files(name, require, walk_d=None):
        '''
        Generate the list of files that need to be kept when a dir based function
        like directory or recurse has a clean.
        '''
    Severity: Minor
    Found in salt/states/file.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

    Function append has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

    def append(name,
               text=None,
               makedirs=False,
               source=None,
               source_hash=None,
    Severity: Minor
    Found in salt/states/file.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

    Function copy_ has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

    def copy_(name,
              source,
              force=False,
              makedirs=False,
              preserve=False,
    Severity: Minor
    Found in salt/states/file.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 symlink. (60)
    Open

    def symlink(
            name,
            target,
            force=False,
            backupname=None,
    Severity: Minor
    Found in salt/states/file.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 _gen_recurse_managed_files has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
    Open

    def _gen_recurse_managed_files(
            name,
            source,
            keep_symlinks=False,
            include_pat=None,
    Severity: Minor
    Found in salt/states/file.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

    Function cached has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    def cached(name,
               source_hash='',
               source_hash_name=None,
               skip_verify=False,
               saltenv='base'):
    Severity: Minor
    Found in salt/states/file.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 mknod has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

    def mknod(name, ntype, major=0, minor=0, user=None, group=None, mode='0600'):
        '''
        Create a special file similar to the 'nix mknod command. The supported
        device types are ``p`` (fifo pipe), ``c`` (character device), and ``b``
        (block device). Provide the major and minor numbers when specifying a
    Severity: Minor
    Found in salt/states/file.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 serialize has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
    Open

    def serialize(name,
                  dataset=None,
                  dataset_pillar=None,
                  user=None,
                  group=None,
    Severity: Minor
    Found in salt/states/file.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

    Cyclomatic complexity is too high in function patch. (50)
    Open

    def patch(name,
              source=None,
              source_hash=None,
              source_hash_name=None,
              skip_verify=False,
    Severity: Minor
    Found in salt/states/file.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 _check_directory_win. (49)
    Open

    def _check_directory_win(name,
                             win_owner=None,
                             win_perms=None,
                             win_deny_perms=None,
                             win_inheritance=None,
    Severity: Minor
    Found in salt/states/file.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 keyvalue. (48)
    Open

    def keyvalue(
            name,
            key=None,
            value=None,
            key_values=None,
    Severity: Minor
    Found in salt/states/file.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 shortcut. (47)
    Open

    def shortcut(
            name,
            target,
            arguments=None,
            working_dir=None,
    Severity: Minor
    Found in salt/states/file.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 retention_schedule has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
    Open

    def retention_schedule(name, retain, strptime_format=None, timezone=None):
        '''
        Apply retention scheduling to backup storage directory.
    
        .. versionadded:: 2016.11.0
    Severity: Minor
    Found in salt/states/file.py - About 6 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 recurse. (39)
    Open

    def recurse(name,
                source,
                keep_source=True,
                clean=False,
                require=None,
    Severity: Minor
    Found in salt/states/file.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 tidied has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def tidied(name,
               age=0,
               matches=None,
               rmdirs=False,
               size=0,
    Severity: Minor
    Found in salt/states/file.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

    Function blockreplace has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

    def blockreplace(
            name,
            marker_start='#-- start managed zone --',
            marker_end='#-- end managed zone --',
            source=None,
    Severity: Minor
    Found in salt/states/file.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 prepend. (35)
    Open

    def prepend(name,
                text=None,
                makedirs=False,
                source=None,
                source_hash=None,
    Severity: Minor
    Found in salt/states/file.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 _check_directory. (34)
    Open

    def _check_directory(name,
                         user=None,
                         group=None,
                         recurse=False,
                         mode=None,
    Severity: Minor
    Found in salt/states/file.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 copy_. (34)
    Open

    def copy_(name,
              source,
              force=False,
              makedirs=False,
              preserve=False,
    Severity: Minor
    Found in salt/states/file.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 append. (32)
    Open

    def append(name,
               text=None,
               makedirs=False,
               source=None,
               source_hash=None,
    Severity: Minor
    Found in salt/states/file.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 serialize. (30)
    Open

    def serialize(name,
                  dataset=None,
                  dataset_pillar=None,
                  user=None,
                  group=None,
    Severity: Minor
    Found in salt/states/file.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 rename has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def rename(name, source, force=False, makedirs=False, **kwargs):
        '''
        If the source file exists on the system, rename it to the named file. The
        named file will not be overwritten if it already exists unless the force
        option is set to True.
    Severity: Minor
    Found in salt/states/file.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def _shortcut_check(name,
                        target,
                        arguments,
                        working_dir,
                        description,
    Severity: Minor
    Found in salt/states/file.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

    Cyclomatic complexity is too high in function cached. (25)
    Open

    def cached(name,
               source_hash='',
               source_hash_name=None,
               skip_verify=False,
               saltenv='base'):
    Severity: Minor
    Found in salt/states/file.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 decode has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def decode(name,
            encoded_data=None,
            contents_pillar=None,
            encoding_type='base64',
            checksum='md5'):
    Severity: Minor
    Found in salt/states/file.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 comment has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def comment(name, regex, char='#', backup='.bak'):
        '''
        Comment out specified lines in a file.
    
        name
    Severity: Minor
    Found in salt/states/file.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 _clean_dir has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _clean_dir(root, keep, exclude_pat):
        '''
        Clean out all of the files and directories in a directory (root) while
        preserving the files in a list (keep) and part of exclude_pat
        '''
    Severity: Minor
    Found in salt/states/file.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

    Cyclomatic complexity is too high in function blockreplace. (21)
    Open

    def blockreplace(
            name,
            marker_start='#-- start managed zone --',
            marker_end='#-- end managed zone --',
            source=None,
    Severity: Minor
    Found in salt/states/file.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 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def absent(name,
               **kwargs):
        '''
        Make sure that the named file or directory is absent. If it exists, it will
        be deleted. This will work to reverse any of the functions in the file
    Severity: Minor
    Found in salt/states/file.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 _find_keep_files has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def _find_keep_files(root, keep):
        '''
        Compile a list of valid keep files (and directories).
        Used by _clean_dir()
        '''
    Severity: Minor
    Found in salt/states/file.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 accumulated has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def accumulated(name, filename, text, **kwargs):
        '''
        Prepare accumulator which can be used in template in file.managed state.
        Accumulator dictionary becomes available in template. It can also be used
        in file.blockreplace.
    Severity: Minor
    Found in salt/states/file.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 line has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def line(name, content=None, match=None, mode=None, location=None,
             before=None, after=None, show_changes=True, backup=False,
             quiet=False, indent=True, create=False, user=None,
             group=None, file_mode=None):
        '''
    Severity: Minor
    Found in salt/states/file.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 _get_template_texts has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_template_texts(source_list=None,
                            template='jinja',
                            defaults=None,
                            context=None,
                            **kwargs):
    Severity: Minor
    Found in salt/states/file.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 uncomment has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def uncomment(name, regex, char='#', backup='.bak'):
        '''
        Uncomment specified commented lines in a file
    
        name
    Severity: Minor
    Found in salt/states/file.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 _symlink_check has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def _symlink_check(name, target, force, user, group, win_owner):
        '''
        Check the symlink function
        '''
        changes = {}
    Severity: Minor
    Found in salt/states/file.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 touch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def touch(name, atime=None, mtime=None, makedirs=False):
        '''
        Replicate the 'nix "touch" command to create a new empty
        file or update the atime and mtime of an existing file.
    
    
    Severity: Minor
    Found in salt/states/file.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 replace has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def replace(name,
                pattern,
                repl,
                count=0,
                flags=8,
    Severity: Minor
    Found in salt/states/file.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 _validate_str_list has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def _validate_str_list(arg, encoding=None):
        '''
        ensure ``arg`` is a list of strings
        '''
        if isinstance(arg, six.binary_type):
    Severity: Minor
    Found in salt/states/file.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 _check_touch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    def _check_touch(name, atime, mtime):
        '''
        Check to see if a file needs to be updated or created
        '''
        ret = {
    Severity: Minor
    Found in salt/states/file.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 group is not None and group != stats.get('group'):
                            fchange['group'] = group
                        if mode is not None and mode != stats.get('mode'):
    Severity: Major
    Found in salt/states/file.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if fchange:
                              changes[path] = fchange
      
          # Recurse skips root (we always do dirs, not root), so always check root:
          if not children_only:
      Severity: Major
      Found in salt/states/file.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if os.path.isdir(fn):
                                if _is_child(fn, name):
                                    if fun == 'recurse':
                                        fkeep = _gen_recurse_managed_files(**low)[3]
                                        log.debug('Keep from %s: %s', fn, fkeep)
        Severity: Major
        Found in salt/states/file.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if user is not None and user != stats.get('user'):
                                  fchange['user'] = user
                              if group is not None and group != stats.get('group'):
          Severity: Major
          Found in salt/states/file.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                for perm in win_perms[user]['perms']:
                                    if not salt.utils.win_dacl.has_permission(
                                            name, user, perm, exact=False):
                                        grant_perms.append(win_perms[user]['perms'])
                            if grant_perms:
            Severity: Major
            Found in salt/states/file.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  for perm in win_deny_perms[user]['perms']:
                                      if not salt.utils.win_dacl.has_permission(
                                              name, user, perm, 'deny', exact=False):
                                          deny_perms.append(win_deny_perms[user]['perms'])
                              if deny_perms:
              Severity: Major
              Found in salt/states/file.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                    if mdir.startswith(link, 0):
                                        log.debug(
                                            '** skipping empty dir ** %s, it intersects a '
                                            'symlink', mdir
                                        )
                Severity: Major
                Found in salt/states/file.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if 'deny' in perms[user]:
                                          if not perms[user]['deny']['applies to'] == applies_to_text:
                                              if 'deny_perms' not in changes:
                                                  changes['deny_perms'] = {}
                                              if user not in changes['deny_perms']:
                  Severity: Major
                  Found in salt/states/file.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if not exc.strerror.startswith('Path not found'):
                                                errors.append(exc.strerror)
                    
                    
                    Severity: Major
                    Found in salt/states/file.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if not exc.strerror.startswith('Path not found'):
                                                  errors.append(exc.strerror)
                      
                      
                      Severity: Major
                      Found in salt/states/file.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                            if 'grant_perms' not in changes:
                                                changes['grant_perms'] = {}
                                            if user not in changes['grant_perms']:
                        Severity: Major
                        Found in salt/states/file.py - About 45 mins to fix

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

                          def not_cached(name, saltenv='base'):
                              '''
                              .. versionadded:: 2017.7.3
                          
                              Ensures that a file is not present in the minion's cache, deleting it
                          Severity: Minor
                          Found in salt/states/file.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 not salt.utils.win_dacl.has_permission(
                                                      name, user, win_perms[user]['perms']):
                                                  grant_perms = win_perms[user]['perms']
                                          else:
                          Severity: Major
                          Found in salt/states/file.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if did_uncomment:
                                                    # irrespective of a value, if it was commented out and
                                                    # changes are still to be made, then it needs to be
                                                    # commented in
                                                    if diff_count[key] > 0:
                            Severity: Major
                            Found in salt/states/file.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                  if fchange:
                                                      changes[path] = fchange
                                          if check_dirs:
                              Severity: Major
                              Found in salt/states/file.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if 'grant' in perms[user]:
                                                        if not perms[user]['grant']['applies to'] == applies_to_text:
                                                            if 'grant_perms' not in changes:
                                                                changes['grant_perms'] = {}
                                                            if user not in changes['grant_perms']:
                                Severity: Major
                                Found in salt/states/file.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                      if user not in changes['deny_perms']:
                                                          changes['deny_perms'][user] = {}
                                                      changes['deny_perms'][user]['perms'] = deny_perms
                                  Severity: Major
                                  Found in salt/states/file.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                        if salt.utils.platform.is_windows():
                                                            ret['comment'] = ('Set ownership of symlink {0} to '
                                                                              '{1}'.format(name, win_owner))
                                                            ret['changes']['ownership'] = win_owner
                                                        else:
                                    Severity: Major
                                    Found in salt/states/file.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                          if line_key.lower() == test_key:
                                                              keys_match = True
                                                      else:
                                      Severity: Major
                                      Found in salt/states/file.py - About 45 mins to fix

                                        Avoid deeply nested control flow statements.
                                        Open

                                                            if not values_match or needs_changing:
                                                                # the old line always needs to go, so that will be
                                                                # reflected in the diff (this is the original line from
                                                                # the file being read)
                                                                diff.append('- {0}'.format(line))
                                        Severity: Major
                                        Found in salt/states/file.py - About 45 mins to fix

                                          Avoid deeply nested control flow statements.
                                          Open

                                                              if mode is not None and mode != stats.get('mode'):
                                                                  fchange['mode'] = mode
                                                              if fchange:
                                          Severity: Major
                                          Found in salt/states/file.py - About 45 mins to fix

                                            Avoid deeply nested control flow statements.
                                            Open

                                                                if 'grant' in perms[user_name] and not perms[user_name]['grant']['inherited']:
                                                                    if 'remove_perms' not in changes:
                                                                        changes['remove_perms'] = {}
                                                                    changes['remove_perms'].update({user_name: perms[user_name]})
                                                            if user_name not in win_deny_perms:
                                            Severity: Major
                                            Found in salt/states/file.py - About 45 mins to fix

                                              Avoid deeply nested control flow statements.
                                              Open

                                                                  if 'deny' in perms[user_name] and not perms[user_name]['deny']['inherited']:
                                                                      if 'remove_perms' not in changes:
                                                                          changes['remove_perms'] = {}
                                                                      changes['remove_perms'].update({user_name: perms[user_name]})
                                              
                                              
                                              Severity: Major
                                              Found in salt/states/file.py - About 45 mins to fix

                                                Avoid deeply nested control flow statements.
                                                Open

                                                                        if salt.utils.platform.is_windows():
                                                                            ret = __salt__['file.check_perms'](
                                                                                path=full,
                                                                                ret=ret,
                                                                                owner=win_owner,
                                                Severity: Major
                                                Found in salt/states/file.py - About 45 mins to fix

                                                  Avoid deeply nested control flow statements.
                                                  Open

                                                                          if salt.utils.platform.is_windows():
                                                                              ret = __salt__['file.check_perms'](
                                                                                  path=full,
                                                                                  ret=ret,
                                                                                  owner=win_owner,
                                                  Severity: Major
                                                  Found in salt/states/file.py - About 45 mins to fix

                                                    Avoid deeply nested control flow statements.
                                                    Open

                                                                        if line_key == test_key:
                                                                            keys_match = True
                                                    
                                                                    # if the key was found in the line and separation was successful
                                                                    if keys_match:
                                                    Severity: Major
                                                    Found in salt/states/file.py - About 45 mins to fix

                                                      Avoid deeply nested control flow statements.
                                                      Open

                                                                          if value_ignore_case:
                                                                              line_value = line_value.lower()
                                                                              test_value = test_value.lower()
                                                      
                                                                          # values match if they are equal at this point
                                                      Severity: Major
                                                      Found in salt/states/file.py - About 45 mins to fix

                                                        Avoid deeply nested control flow statements.
                                                        Open

                                                                            if diff_count[key] > 0:
                                                                                diff_count[key] -= 1
                                                                            # at this point a continue saves going through the rest of
                                                                            # the keys to see if they match since this line already
                                                                            #matched the current key
                                                        Severity: Major
                                                        Found in salt/states/file.py - About 45 mins to fix

                                                          Avoid deeply nested control flow statements.
                                                          Open

                                                                              if 'deny_perms' not in changes:
                                                                                  changes['deny_perms'] = {}
                                                                              if user not in changes['deny_perms']:
                                                          Severity: Major
                                                          Found in salt/states/file.py - About 45 mins to fix

                                                            Avoid deeply nested control flow statements.
                                                            Open

                                                                                if salt.utils.platform.is_windows():
                                                                                    ret['comment'] += (
                                                                                        'Failed to set ownership of symlink '
                                                                                        '{0} to {1}'.format(name, win_owner))
                                                                                else:
                                                            Severity: Major
                                                            Found in salt/states/file.py - About 45 mins to fix

                                                              Avoid deeply nested control flow statements.
                                                              Open

                                                                                  if user not in changes['grant_perms']:
                                                                                      changes['grant_perms'][user] = {}
                                                                                  changes['grant_perms'][user]['perms'] = grant_perms
                                                              Severity: Major
                                                              Found in salt/states/file.py - About 45 mins to fix

                                                                Avoid deeply nested control flow statements.
                                                                Open

                                                                                    if not salt.utils.win_dacl.has_permission(
                                                                                            name, user, win_deny_perms[user]['perms'], 'deny'):
                                                                                        deny_perms = win_deny_perms[user]['perms']
                                                                                else:
                                                                Severity: Major
                                                                Found in salt/states/file.py - About 45 mins to fix

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

                                                                  def _check_dir_meta(name,
                                                                                      user,
                                                                                      group,
                                                                                      mode,
                                                                                      follow_symlinks=False):
                                                                  Severity: Minor
                                                                  Found in salt/states/file.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 _get_recurse_set has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                                                  Open

                                                                  def _get_recurse_set(recurse):
                                                                      '''
                                                                      Converse *recurse* definition to a set of strings.
                                                                  
                                                                      Raises TypeError or ValueError when *recurse* has wrong structure.
                                                                  Severity: Minor
                                                                  Found in salt/states/file.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 _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                  Severity: Major
                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                    Avoid too many return statements within this function.
                                                                    Open

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

                                                                      Avoid too many return statements within this function.
                                                                      Open

                                                                                      return _error(ret, ((
                                                                      Severity: Major
                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                        Avoid too many return statements within this function.
                                                                        Open

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

                                                                          Avoid too many return statements within this function.
                                                                          Open

                                                                                  return False, ('Link or directory exists where the shortcut "{0}" '
                                                                          Severity: Major
                                                                          Found in salt/states/file.py - About 30 mins to fix

                                                                            Avoid too many return statements within this function.
                                                                            Open

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

                                                                              Avoid too many return statements within this function.
                                                                              Open

                                                                                      return False, ('File or directory exists where the symlink {0} '
                                                                              Severity: Major
                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                Avoid too many return statements within this function.
                                                                                Open

                                                                                                return _error(ret,
                                                                                Severity: Major
                                                                                Found in salt/states/file.py - About 30 mins to fix

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

                                                                                                  return _error(
                                                                                  Severity: Major
                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

                                                                                                        return _error(ret, (('Backupname must be an absolute path '
                                                                                    Severity: Major
                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

                                                                                                      return _error(ret, ('Unable to rename {0} to backup {1} -> '
                                                                                      Severity: Major
                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

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

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

                                                                                                              return _error(ret, (('Symlink & backup dest exists and Force not set.'
                                                                                          Severity: Major
                                                                                          Found in salt/states/file.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

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

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

                                                                                                              return _error(
                                                                                              Severity: Major
                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

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

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

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

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

                                                                                                            return _error(
                                                                                                    Severity: Major
                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

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

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

                                                                                                                            return _error(ret, ((
                                                                                                        Severity: Major
                                                                                                        Found in salt/states/file.py - About 30 mins to fix

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

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

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

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

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

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

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

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

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                              return _error(ret, 'Failed to remove directory {0}'.format(name))
                                                                                                                  Severity: Major
                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

                                                                                                                                return _error(
                                                                                                                    Severity: Major
                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

                                                                                                                              return _error(
                                                                                                                      Severity: Major
                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

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

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

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

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

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

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

                                                                                                                                                  return _error(ret, ((
                                                                                                                              Severity: Major
                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

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

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

                                                                                                                                              return _error(ret, '{0}'.format(exc))
                                                                                                                                  Severity: Major
                                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

                                                                                                                                            return _error(ret, 'Unable to manage file: {0}'.format(exc))
                                                                                                                                    Severity: Major
                                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                      Open

                                                                                                                                                      return _error(
                                                                                                                                      Severity: Major
                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                        Open

                                                                                                                                                        return _error(
                                                                                                                                        Severity: Major
                                                                                                                                        Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                          Open

                                                                                                                                                      return _error(ret, check_msg)
                                                                                                                                          Severity: Major
                                                                                                                                          Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                            Open

                                                                                                                                                            return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                                                                                            Severity: Major
                                                                                                                                            Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                              Open

                                                                                                                                                              return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                                                                                              Severity: Major
                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                Open

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

                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                  Open

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

                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                    Open

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

                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                      Open

                                                                                                                                                                  return _error(ret, ((
                                                                                                                                                      Severity: Major
                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                        Open

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

                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                          Open

                                                                                                                                                                          return _error(
                                                                                                                                                          Severity: Major
                                                                                                                                                          Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                            Open

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

                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                              Open

                                                                                                                                                                      return _error(ret, comment_)
                                                                                                                                                              Severity: Major
                                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                Open

                                                                                                                                                                                    return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                                                                                                                Severity: Major
                                                                                                                                                                Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                  Open

                                                                                                                                                                              return _error(ret, check_msg)
                                                                                                                                                                  Severity: Major
                                                                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                    Open

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

                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                      Open

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

                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                        Open

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

                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                          Open

                                                                                                                                                                                      return _error(
                                                                                                                                                                          Severity: Major
                                                                                                                                                                          Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                            Open

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

                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                              Open

                                                                                                                                                                                                  return _error(
                                                                                                                                                                              Severity: Major
                                                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                Open

                                                                                                                                                                                        return _error(
                                                                                                                                                                                Severity: Major
                                                                                                                                                                                Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                  Open

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

                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                    Open

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

                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                      Open

                                                                                                                                                                                                  return __salt__['file.manage_file'](
                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                        Open

                                                                                                                                                                                                    return _error(ret, ('Invalid source \'{0}\' '
                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                        Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                          Open

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

                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                            Open

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

                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                              Open

                                                                                                                                                                                                              return _error(
                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                Open

                                                                                                                                                                                                                return _error(
                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                    Open

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

                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                Open

                                                                                                                                                                                                                        return _error(
                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                  return _error(
                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                            return _error(ret, u_check)
                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                              return _error(
                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                return _error(ret, 'Failed to create directory {0}'.format(name))
                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                        Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                    Open

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

                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                          return _error(ret, 'No text found to append. Nothing appended')
                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                                    Open

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

                                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                              return _error(
                                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                                return _error(
                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                                              return {'changes': {},
                                                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                Open

                                                                                                                                                                                                                                                                                        return _error(
                                                                                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                                                                                Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                    Open

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

                                                                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                                                                return _error(
                                                                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                                                                        Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                                                                          return _error(
                                                                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                                                            return _error(
                                                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                                                                                      return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                        Open

                                                                                                                                                                                                                                                                                                                            return _error(ret, (
                                                                                                                                                                                                                                                                                                        Severity: Major
                                                                                                                                                                                                                                                                                                        Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                          Open

                                                                                                                                                                                                                                                                                                                  return _error(
                                                                                                                                                                                                                                                                                                          Severity: Major
                                                                                                                                                                                                                                                                                                          Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                                                                                                      return _error(
                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                                                                                    return _error(
                                                                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                                                                                                                                  return _error(ret, 'Unable to manage file: {0}'.format(exc))
                                                                                                                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                                                                                                                      Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                                                                                                          return _error(
                                                                                                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                Open

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

                                                                                                                                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                  Open

                                                                                                                                                                                                                                                                                                                                              return _error(ret, 'Unable to check_cmd file: {0}'.format(exc))
                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                    Open

                                                                                                                                                                                                                                                                                                                                                    return _error(
                                                                                                                                                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                                                                                                                                                    Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                            Open

                                                                                                                                                                                                                                                                                                                                                            return _error(
                                                                                                                                                                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                                                                                                                                                                            Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                              Open

                                                                                                                                                                                                                                                                                                                                                                      return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                                                                                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                                                                                                                                              Found in salt/states/file.py - About 30 mins to fix

                                                                                                                                                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                                                                                                                                                Open

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

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

                                                                                                                                                                                                                                                                                                                                                  def _makedirs(name,
                                                                                                                                                                                                                                                                                                                                                                user=None,
                                                                                                                                                                                                                                                                                                                                                                group=None,
                                                                                                                                                                                                                                                                                                                                                                dir_mode=None,
                                                                                                                                                                                                                                                                                                                                                                win_owner=None,
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.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

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

                                                                                                                                                                                                                                                                                                                                                  def _set_symlink_ownership(path, user, group, win_owner):
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                      Set the ownership of a symlink and return a boolean indicating
                                                                                                                                                                                                                                                                                                                                                      success/failure
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.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

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

                                                                                                                                                                                                                                                                                                                                                  def _unify_sources_and_hashes(source=None, source_hash=None,
                                                                                                                                                                                                                                                                                                                                                                                sources=None, source_hashes=None):
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                      Silly little function to give us a standard tuple list for sources and
                                                                                                                                                                                                                                                                                                                                                      source_hashes
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.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

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

                                                                                                                                                                                                                                                                                                                                                  def _check_user(user, group):
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                      Checks if the named user and group are present on the minion
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                      err = ''
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.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

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

                                                                                                                                                                                                                                                                                                                                                  def _depth_limited_walk(top, max_depth=None):
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                      Walk the directory tree under root up till reaching max_depth.
                                                                                                                                                                                                                                                                                                                                                      With max_depth=None (default), do not limit depth.
                                                                                                                                                                                                                                                                                                                                                      '''
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.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

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

                                                                                                                                                                                                                                                                                                                                                      elif ntype == 'b':
                                                                                                                                                                                                                                                                                                                                                          # Check for file existence
                                                                                                                                                                                                                                                                                                                                                          if __salt__['file.file_exists'](name):
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = (
                                                                                                                                                                                                                                                                                                                                                                  'File {0} exists and is not a block device. Refusing to '
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 7683..7724

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

                                                                                                                                                                                                                                                                                                                                                  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 ntype == 'c':
                                                                                                                                                                                                                                                                                                                                                          # Check for file existence
                                                                                                                                                                                                                                                                                                                                                          if __salt__['file.file_exists'](name):
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = (
                                                                                                                                                                                                                                                                                                                                                                  'File {0} exists and is not a character device. Refusing '
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 7729..7770

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

                                                                                                                                                                                                                                                                                                                                                  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 user in perms:
                                                                                                                                                                                                                                                                                                                                                                      user = salt.utils.win_dacl.get_name(user)
                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                      # Get the proper applies_to text
                                                                                                                                                                                                                                                                                                                                                                      at_flag = salt.utils.win_dacl.flags().ace_prop['file'][applies_to]
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 911..924

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

                                                                                                                                                                                                                                                                                                                                                  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 user in perms:
                                                                                                                                                                                                                                                                                                                                                                      user = salt.utils.win_dacl.get_name(user)
                                                                                                                                                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                                                                                                      # Get the proper applies_to text
                                                                                                                                                                                                                                                                                                                                                                      at_flag = salt.utils.win_dacl.flags().ace_prop['file'][applies_to]
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 863..876

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

                                                                                                                                                                                                                                                                                                                                                  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 check_files:
                                                                                                                                                                                                                                                                                                                                                                  for fn_ in files:
                                                                                                                                                                                                                                                                                                                                                                      full = os.path.join(root, fn_)
                                                                                                                                                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                                                                                                                                                          if salt.utils.platform.is_windows():
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3593..3611

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

                                                                                                                                                                                                                                                                                                                                                  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 check_dirs:
                                                                                                                                                                                                                                                                                                                                                                  for dir_ in dirs:
                                                                                                                                                                                                                                                                                                                                                                      full = os.path.join(root, dir_)
                                                                                                                                                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                                                                                                                                                          if salt.utils.platform.is_windows():
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3573..3591

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

                                                                                                                                                                                                                                                                                                                                                  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 contents_pillar is not None:
                                                                                                                                                                                                                                                                                                                                                          if isinstance(contents_pillar, list):
                                                                                                                                                                                                                                                                                                                                                              list_contents = []
                                                                                                                                                                                                                                                                                                                                                              for nextp in contents_pillar:
                                                                                                                                                                                                                                                                                                                                                                  nextc = __salt__['pillar.get'](nextp, __NOT_FOUND,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2660..2679

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

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                      elif contents_grains is not None:
                                                                                                                                                                                                                                                                                                                                                          if isinstance(contents_grains, list):
                                                                                                                                                                                                                                                                                                                                                              list_contents = []
                                                                                                                                                                                                                                                                                                                                                              for nextg in contents_grains:
                                                                                                                                                                                                                                                                                                                                                                  nextc = __salt__['grains.get'](nextg, __NOT_FOUND,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 day to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2638..2657

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

                                                                                                                                                                                                                                                                                                                                                  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 __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Directory {0} is set to be updated'.format(dirname)
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              if not __salt__['file.directory_exists'](dirname):
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 7 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6191..6203

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                          if not __salt__['file.directory_exists'](dirname):
                                                                                                                                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                                                                                                                                  _makedirs(name=name)
                                                                                                                                                                                                                                                                                                                                                              except CommandExecutionError as exc:
                                                                                                                                                                                                                                                                                                                                                                  return _error(ret, 'Drive {0} is not mapped'.format(exc.message))
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 7 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5904..5920

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

                                                                                                                                                                                                                                                                                                                                                  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 'group' in recurse_set:
                                                                                                                                                                                                                                                                                                                                                              if group or isinstance(group, int):
                                                                                                                                                                                                                                                                                                                                                                  gid = __salt__['file.group_to_gid'](group)
                                                                                                                                                                                                                                                                                                                                                                  # As above with user, we need to make sure group exists.
                                                                                                                                                                                                                                                                                                                                                                  if isinstance(gid, six.string_types):
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 6 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3528..3545

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

                                                                                                                                                                                                                                                                                                                                                  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 'user' in recurse_set:
                                                                                                                                                                                                                                                                                                                                                              if user or isinstance(user, int):
                                                                                                                                                                                                                                                                                                                                                                  uid = __salt__['file.user_to_uid'](user)
                                                                                                                                                                                                                                                                                                                                                                  # file.user_to_uid returns '' if user does not exist. Above
                                                                                                                                                                                                                                                                                                                                                                  # check for user is not fatal, so we need to be sure user
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 6 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3546..3560

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

                                                                                                                                                                                                                                                                                                                                                  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 clean and os.path.exists(path) and os.path.isdir(path) and replace:
                                                                                                                                                                                                                                                                                                                                                              _ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
                                                                                                                                                                                                                                                                                                                                                              if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                                  _ret['comment'] = 'Replacing directory {0} with a ' \
                                                                                                                                                                                                                                                                                                                                                                                    'file'.format(path)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4045..4055

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

                                                                                                                                                                                                                                                                                                                                                  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 clean and os.path.exists(path) and not os.path.isdir(path):
                                                                                                                                                                                                                                                                                                                                                              _ret = {'name': name, 'changes': {}, 'result': True, 'comment': ''}
                                                                                                                                                                                                                                                                                                                                                              if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                                  _ret['comment'] = 'Replacing {0} with a directory'.format(path)
                                                                                                                                                                                                                                                                                                                                                                  _ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4004..4016

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

                                                                                                                                                                                                                                                                                                                                                  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 changes:
                                                                                                                                                                                                                                                                                                                                                          ret['changes']['diff'] = changes
                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Changes would be made'
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 2 other locations - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4839..4849
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5515..5525

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 99.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if changes:
                                                                                                                                                                                                                                                                                                                                                          ret['changes']['diff'] = changes
                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Changes would have been made'
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 2 other locations - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4638..4648
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5515..5525

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 99.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if changes:
                                                                                                                                                                                                                                                                                                                                                          ret['changes']['diff'] = changes
                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Changes would be made'
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 2 other locations - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4638..4648
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4839..4849

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 99.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                                  if user_name not in win_perms:
                                                                                                                                                                                                                                                                                                                                                                      if 'grant' in perms[user_name] and not perms[user_name]['grant']['inherited']:
                                                                                                                                                                                                                                                                                                                                                                          if 'remove_perms' not in changes:
                                                                                                                                                                                                                                                                                                                                                                              changes['remove_perms'] = {}
                                                                                                                                                                                                                                                                                                                                                                          changes['remove_perms'].update({user_name: perms[user_name]})
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 939..943

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 99.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                                  if user_name not in win_deny_perms:
                                                                                                                                                                                                                                                                                                                                                                      if 'deny' in perms[user_name] and not perms[user_name]['deny']['inherited']:
                                                                                                                                                                                                                                                                                                                                                                          if 'remove_perms' not in changes:
                                                                                                                                                                                                                                                                                                                                                                              changes['remove_perms'] = {}
                                                                                                                                                                                                                                                                                                                                                                          changes['remove_perms'].update({user_name: perms[user_name]})
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 934..938

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 99.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                              if not isinstance(contents, six.string_types):
                                                                                                                                                                                                                                                                                                                                                                  if 'result' in contents:
                                                                                                                                                                                                                                                                                                                                                                      ret['result'] = contents['result']
                                                                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                                                                      ret['result'] = False
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 5 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/modules/napalm_network.py on lines 1943..1952

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

                                                                                                                                                                                                                                                                                                                                                  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 grant_perms:
                                                                                                                                                                                                                                                                                                                                                                      if 'grant_perms' not in changes:
                                                                                                                                                                                                                                                                                                                                                                          changes['grant_perms'] = {}
                                                                                                                                                                                                                                                                                                                                                                      if user not in changes['grant_perms']:
                                                                                                                                                                                                                                                                                                                                                                          changes['grant_perms'][user] = {}
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 898..903

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

                                                                                                                                                                                                                                                                                                                                                  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 deny_perms:
                                                                                                                                                                                                                                                                                                                                                                      if 'deny_perms' not in changes:
                                                                                                                                                                                                                                                                                                                                                                          changes['deny_perms'] = {}
                                                                                                                                                                                                                                                                                                                                                                      if user not in changes['deny_perms']:
                                                                                                                                                                                                                                                                                                                                                                          changes['deny_perms'][user] = {}
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 850..855

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if slines != nlines:
                                                                                                                                                                                                                                                                                                                                                          if not __utils__['files.is_text'](name):
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['diff'] = 'Replace binary file'
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              # Changes happened, add them
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5617..5623
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6001..6007
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6303..6309

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if slines != nlines:
                                                                                                                                                                                                                                                                                                                                                          if not __utils__['files.is_text'](name):
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['diff'] = 'Replace binary file'
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              # Changes happened, add them
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5617..5623
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5722..5728
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6001..6007

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if slines != nlines:
                                                                                                                                                                                                                                                                                                                                                          if not __utils__['files.is_text'](name):
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['diff'] = 'Replace binary file'
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              # Changes happened, add them
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5617..5623
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5722..5728
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6303..6309

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if slines != nlines:
                                                                                                                                                                                                                                                                                                                                                          if not __utils__['files.is_text'](name):
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['diff'] = 'Replace binary file'
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              # Changes happened, add them
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5722..5728
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6001..6007
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6303..6309

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                              if not keep_source:
                                                                                                                                                                                                                                                                                                                                                                  if not sfn \
                                                                                                                                                                                                                                                                                                                                                                          and source \
                                                                                                                                                                                                                                                                                                                                                                          and _urlparse(source).scheme == 'salt':
                                                                                                                                                                                                                                                                                                                                                                      # The file would not have been cached until manage_file was
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2979..2987

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                              if not keep_source:
                                                                                                                                                                                                                                                                                                                                                                  if not sfn \
                                                                                                                                                                                                                                                                                                                                                                          and source \
                                                                                                                                                                                                                                                                                                                                                                          and _urlparse(source).scheme == 'salt':
                                                                                                                                                                                                                                                                                                                                                                      # The file would not have been cached until manage_file was
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3063..3071

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

                                                                                                                                                                                                                                                                                                                                                  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 post_hash == source_sum['hsum']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = True
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = (
                                                                                                                                                                                                                                                                                                                                                                  'File is already cached to {0} with hash {1}'.format(
                                                                                                                                                                                                                                                                                                                                                                      local_copy, post_hash
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 8357..8367

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

                                                                                                                                                                                                                                                                                                                                                  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 copy_target_user:
                                                                                                                                                                                                                                                                                                                                                          if user:
                                                                                                                                                                                                                                                                                                                                                              log.warning('`copy_target_user` and `user` are mutually exclusive. Using `user`.')
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1509..1518

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

                                                                                                                                                                                                                                                                                                                                                  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 copy_target_group:
                                                                                                                                                                                                                                                                                                                                                          if group:
                                                                                                                                                                                                                                                                                                                                                              log.warning('`copy_target_group` and `group` are mutually exclusive. Using `group`.')
                                                                                                                                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1463..1472

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

                                                                                                                                                                                                                                                                                                                                                  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 local_hash == source_sum['hsum']:
                                                                                                                                                                                                                                                                                                                                                                      ret['result'] = True
                                                                                                                                                                                                                                                                                                                                                                      ret['comment'] = (
                                                                                                                                                                                                                                                                                                                                                                          'File {0} is present on the minion and has hash '
                                                                                                                                                                                                                                                                                                                                                                          '{1}'.format(full_path, local_hash)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 8468..8479

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      if not check_res:
                                                                                                                                                                                                                                                                                                                                                          # Try to create the file
                                                                                                                                                                                                                                                                                                                                                          touch_ret = touch(name, makedirs=makedirs)
                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              return touch_ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5923..5930

                                                                                                                                                                                                                                                                                                                                                  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 not check_res:
                                                                                                                                                                                                                                                                                                                                                          # Try to create the file
                                                                                                                                                                                                                                                                                                                                                          touch_ret = touch(name, makedirs=makedirs)
                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              return touch_ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6206..6213

                                                                                                                                                                                                                                                                                                                                                  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 __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                          ret['changes'][name] = 'updated'
                                                                                                                                                                                                                                                                                                                                                          ret['comment'] = 'File {0} is set to be updated'.format(name)
                                                                                                                                                                                                                                                                                                                                                          ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                          return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5700..5704

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                      if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                          ret['changes'][name] = 'updated'
                                                                                                                                                                                                                                                                                                                                                          ret['comment'] = 'File {0} is set to be updated'.format(name)
                                                                                                                                                                                                                                                                                                                                                          ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                          return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5594..5598

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

                                                                                                                                                                                                                                                                                                                                                              ret = __salt__['file.manage_file'](
                                                                                                                                                                                                                                                                                                                                                                  tmp_filename,
                                                                                                                                                                                                                                                                                                                                                                  sfn,
                                                                                                                                                                                                                                                                                                                                                                  ret,
                                                                                                                                                                                                                                                                                                                                                                  source,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3024..3043

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

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                              return __salt__['file.manage_file'](
                                                                                                                                                                                                                                                                                                                                                                  name,
                                                                                                                                                                                                                                                                                                                                                                  sfn,
                                                                                                                                                                                                                                                                                                                                                                  ret,
                                                                                                                                                                                                                                                                                                                                                                  source,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2943..2962

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

                                                                                                                                                                                                                                                                                                                                                  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 sl_:
                                                                                                                                                                                                                                                                                                                                                          tmpret = _get_template_texts(source_list=sl_,
                                                                                                                                                                                                                                                                                                                                                                                       template=template,
                                                                                                                                                                                                                                                                                                                                                                                       defaults=defaults,
                                                                                                                                                                                                                                                                                                                                                                                       context=context)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5933..5940

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      if sl_:
                                                                                                                                                                                                                                                                                                                                                          tmpret = _get_template_texts(source_list=sl_,
                                                                                                                                                                                                                                                                                                                                                                                       template=template,
                                                                                                                                                                                                                                                                                                                                                                                       defaults=defaults,
                                                                                                                                                                                                                                                                                                                                                                                       context=context)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6216..6223

                                                                                                                                                                                                                                                                                                                                                  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 __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['removed'] = name
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'File {0} is set for removal'.format(name)
                                                                                                                                                                                                                                                                                                                                                              return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1755..1759

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

                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['removed'] = name
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Directory {0} is set for removal'.format(name)
                                                                                                                                                                                                                                                                                                                                                              return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1741..1745

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

                                                                                                                                                                                                                                                                                                                                                              elif __salt__['file.is_link'](name):
                                                                                                                                                                                                                                                                                                                                                                  if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                                      ret['changes']['forced'] = 'Symlink would be forcibly replaced'
                                                                                                                                                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                                                                                                                                                      __salt__['file.remove'](name)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3411..3422

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

                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              ret['result'] = None
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = '{0} is set for tidy'.format(name)
                                                                                                                                                                                                                                                                                                                                                              ret['changes'] = {'removed': todelete}
                                                                                                                                                                                                                                                                                                                                                              return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/grains.py on lines 225..229

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

                                                                                                                                                                                                                                                                                                                                                  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__['file.remove'](name, force=True)
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Removed directory {0}'.format(name)
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['removed'] = name
                                                                                                                                                                                                                                                                                                                                                              return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1746..1750

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 55.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                              if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                                  pcomment += '\n{0} will be created'.format(os.path.dirname(name))
                                                                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                                                                                                                                      _makedirs(name=name,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3461..3473

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 55.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                                                                                                                                              __salt__['file.remove'](name, force=True)
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = 'Removed file {0}'.format(name)
                                                                                                                                                                                                                                                                                                                                                              ret['changes']['removed'] = name
                                                                                                                                                                                                                                                                                                                                                              return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1760..1764

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 55.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                              if makedirs:
                                                                                                                                                                                                                                                                                                                                                                  # Everything's good, create the parent Dirs
                                                                                                                                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                                                                                                                                      _makedirs(name=name,
                                                                                                                                                                                                                                                                                                                                                                                user=user,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1578..1591

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 55.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      with salt.utils.files.fopen(name, 'rb') as fp_:
                                                                                                                                                                                                                                                                                                                                                          slines = fp_.read()
                                                                                                                                                                                                                                                                                                                                                          if six.PY3:
                                                                                                                                                                                                                                                                                                                                                              slines = slines.decode(__salt_system_encoding__)
                                                                                                                                                                                                                                                                                                                                                          slines = slines.splitlines(True)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5599..5603
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5608..5612
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6297..6301

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      with salt.utils.files.fopen(name, 'rb') as fp_:
                                                                                                                                                                                                                                                                                                                                                          slines = fp_.read()
                                                                                                                                                                                                                                                                                                                                                          if six.PY3:
                                                                                                                                                                                                                                                                                                                                                              slines = slines.decode(__salt_system_encoding__)
                                                                                                                                                                                                                                                                                                                                                          slines = slines.splitlines(True)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5608..5612
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6227..6231
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6297..6301

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      with salt.utils.files.fopen(name, 'rb') as fp_:
                                                                                                                                                                                                                                                                                                                                                          nlines = fp_.read()
                                                                                                                                                                                                                                                                                                                                                          if six.PY3:
                                                                                                                                                                                                                                                                                                                                                              nlines = nlines.decode(__salt_system_encoding__)
                                                                                                                                                                                                                                                                                                                                                          nlines = nlines.splitlines(True)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5599..5603
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6227..6231
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6297..6301

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

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                      with salt.utils.files.fopen(name, 'rb') as fp_:
                                                                                                                                                                                                                                                                                                                                                          nlines = fp_.read()
                                                                                                                                                                                                                                                                                                                                                          if six.PY3:
                                                                                                                                                                                                                                                                                                                                                              nlines = nlines.decode(__salt_system_encoding__)
                                                                                                                                                                                                                                                                                                                                                          nlines = nlines.splitlines(True)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 3 other locations - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5599..5603
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5608..5612
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6227..6231

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

                                                                                                                                                                                                                                                                                                                                                  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 __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                          ret['result'] = presult
                                                                                                                                                                                                                                                                                                                                                          ret['comment'] = pcomment
                                                                                                                                                                                                                                                                                                                                                          ret['changes'] = pchanges
                                                                                                                                                                                                                                                                                                                                                          return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 8082..8086

                                                                                                                                                                                                                                                                                                                                                  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 __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                          ret['result'] = presult
                                                                                                                                                                                                                                                                                                                                                          ret['comment'] = pcomment
                                                                                                                                                                                                                                                                                                                                                          ret['changes'] = pchanges
                                                                                                                                                                                                                                                                                                                                                          return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1604..1608

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      if errors:
                                                                                                                                                                                                                                                                                                                                                          ret['result'] = False
                                                                                                                                                                                                                                                                                                                                                          ret['comment'] += '\n\nThe following errors were encountered:\n'
                                                                                                                                                                                                                                                                                                                                                          for error in errors:
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] += '\n- {0}'.format(error)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/archive.py on lines 1539..1546

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

                                                                                                                                                                                                                                                                                                                                                  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 preflight_errors:
                                                                                                                                                                                                                                                                                                                                                          msg = '. '.join(preflight_errors)
                                                                                                                                                                                                                                                                                                                                                          if len(preflight_errors) > 1:
                                                                                                                                                                                                                                                                                                                                                              msg += '.'
                                                                                                                                                                                                                                                                                                                                                          return _error(ret, msg)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1563..1567

                                                                                                                                                                                                                                                                                                                                                  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 not create:
                                                                                                                                                                                                                                                                                                                                                          if not os.path.isfile(name):
                                                                                                                                                                                                                                                                                                                                                              # Don't create a file that is not already present
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = ('File {0} is not present and is not set for '
                                                                                                                                                                                                                                                                                                                                                                                'creation').format(name)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 7445..7450

                                                                                                                                                                                                                                                                                                                                                  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 preflight_errors:
                                                                                                                                                                                                                                                                                                                                                          msg = '. '.join(preflight_errors)
                                                                                                                                                                                                                                                                                                                                                          if len(preflight_errors) > 1:
                                                                                                                                                                                                                                                                                                                                                              msg += '.'
                                                                                                                                                                                                                                                                                                                                                          return _error(ret, msg)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 8068..8072

                                                                                                                                                                                                                                                                                                                                                  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 not create:
                                                                                                                                                                                                                                                                                                                                                          if not os.path.isfile(name):
                                                                                                                                                                                                                                                                                                                                                              # Don't create a file that is not already present
                                                                                                                                                                                                                                                                                                                                                              ret['comment'] = ('File {0} is not present and is not set for '
                                                                                                                                                                                                                                                                                                                                                                                'creation').format(name)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2763..2768

                                                                                                                                                                                                                                                                                                                                                  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 not __salt__['user.info'](user):
                                                                                                                                                                                                                                                                                                                                                              # User not found, use the account salt is running under
                                                                                                                                                                                                                                                                                                                                                              # If username not found, use System
                                                                                                                                                                                                                                                                                                                                                              user = __salt__['user.current']()
                                                                                                                                                                                                                                                                                                                                                              if not user:
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 8050..8055

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                                                                                                                                          sfn, source_sum, comment_ = __salt__['file.get_managed'](
                                                                                                                                                                                                                                                                                                                                                              name,
                                                                                                                                                                                                                                                                                                                                                              template,
                                                                                                                                                                                                                                                                                                                                                              source,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 3023..3059

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                                                                                                                                              return __salt__['file.manage_file'](
                                                                                                                                                                                                                                                                                                                                                                  name,
                                                                                                                                                                                                                                                                                                                                                                  sfn,
                                                                                                                                                                                                                                                                                                                                                                  ret,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2903..2923

                                                                                                                                                                                                                                                                                                                                                  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 not __salt__['user.info'](user):
                                                                                                                                                                                                                                                                                                                                                          # User not found, use the account salt is running under
                                                                                                                                                                                                                                                                                                                                                          # If username not found, use System
                                                                                                                                                                                                                                                                                                                                                          user = __salt__['user.current']()
                                                                                                                                                                                                                                                                                                                                                          if not user:
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1481..1486

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      with salt.utils.files.fopen(name, 'rb') as fp_:
                                                                                                                                                                                                                                                                                                                                                          slines = fp_.read()
                                                                                                                                                                                                                                                                                                                                                          if six.PY3:
                                                                                                                                                                                                                                                                                                                                                              slines = slines.decode(__salt_system_encoding__)
                                                                                                                                                                                                                                                                                                                                                          slines = slines.splitlines()
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5995..5999

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                      with salt.utils.files.fopen(name, 'rb') as fp_:
                                                                                                                                                                                                                                                                                                                                                          nlines = fp_.read()
                                                                                                                                                                                                                                                                                                                                                          if six.PY3:
                                                                                                                                                                                                                                                                                                                                                              nlines = nlines.decode(__salt_system_encoding__)
                                                                                                                                                                                                                                                                                                                                                          nlines = nlines.splitlines()
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 5944..5948

                                                                                                                                                                                                                                                                                                                                                  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 (group is not None
                                                                                                                                                                                                                                                                                                                                                              and group != stats['group']
                                                                                                                                                                                                                                                                                                                                                              and group != stats.get('gid')):
                                                                                                                                                                                                                                                                                                                                                          changes['group'] = group
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 968..971

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

                                                                                                                                                                                                                                                                                                                                                  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 (user is not None
                                                                                                                                                                                                                                                                                                                                                              and user != stats['user']
                                                                                                                                                                                                                                                                                                                                                              and user != stats.get('uid')):
                                                                                                                                                                                                                                                                                                                                                          changes['user'] = user
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 972..975

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 51.

                                                                                                                                                                                                                                                                                                                                                  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 group is None:
                                                                                                                                                                                                                                                                                                                                                          group = __salt__['file.gid_to_group'](
                                                                                                                                                                                                                                                                                                                                                              __salt__['user.info'](user).get('gid', 0)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 6933..6935

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                          if group is None:
                                                                                                                                                                                                                                                                                                                                                              group = __salt__['file.gid_to_group'](
                                                                                                                                                                                                                                                                                                                                                                  __salt__['user.info'](user).get('gid', 0)
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1520..1522

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                          if win_perms:
                                                                                                                                                                                                                                                                                                                                                              for name_check in win_perms:
                                                                                                                                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                                                                                                                                      salt.utils.win_functions.get_sid_from_name(name_check)
                                                                                                                                                                                                                                                                                                                                                                  except CommandExecutionError as exc:
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1542..1547

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 47.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                          if win_deny_perms:
                                                                                                                                                                                                                                                                                                                                                              for name_check in win_deny_perms:
                                                                                                                                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                                                                                                                                      salt.utils.win_functions.get_sid_from_name(name_check)
                                                                                                                                                                                                                                                                                                                                                                  except CommandExecutionError as exc:
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 1534..1539

                                                                                                                                                                                                                                                                                                                                                  Duplicated Code

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Tuning

                                                                                                                                                                                                                                                                                                                                                  This issue has a mass of 47.

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

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

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

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

                                                                                                                                                                                                                                                                                                                                                  Refactorings

                                                                                                                                                                                                                                                                                                                                                  Further Reading

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

                                                                                                                                                                                                                                                                                                                                                  def directory(name,
                                                                                                                                                                                                                                                                                                                                                                user=None,
                                                                                                                                                                                                                                                                                                                                                                group=None,
                                                                                                                                                                                                                                                                                                                                                                recurse=None,
                                                                                                                                                                                                                                                                                                                                                                max_depth=None,
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 2 other locations - About 50 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/modules/boto_elasticache.py on lines 540..547
                                                                                                                                                                                                                                                                                                                                                  salt/states/virt.py on lines 239..259

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      changes = __salt__['file.line'](
                                                                                                                                                                                                                                                                                                                                                          name, content, match=match, mode=mode, location=location,
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 50 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/modules/dockermod.py on lines 6048..6050

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                          for item in arg:
                                                                                                                                                                                                                                                                                                                                                              if isinstance(item, six.string_types):
                                                                                                                                                                                                                                                                                                                                                                  ret.append(item)
                                                                                                                                                                                                                                                                                                                                                              else:
                                                                                                                                                                                                                                                                                                                                                                  ret.append(six.text_type(item))
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 2 other locations - About 40 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/modules/git.py on lines 153..157
                                                                                                                                                                                                                                                                                                                                                  salt/states/git.py on lines 3358..3362

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      if user:
                                                                                                                                                                                                                                                                                                                                                          uid = __salt__['file.user_to_uid'](user)
                                                                                                                                                                                                                                                                                                                                                          if uid == '':
                                                                                                                                                                                                                                                                                                                                                              err += 'User {0} is not available '.format(user)
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 388..391

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      if group:
                                                                                                                                                                                                                                                                                                                                                          gid = __salt__['file.group_to_gid'](group)
                                                                                                                                                                                                                                                                                                                                                          if gid == '':
                                                                                                                                                                                                                                                                                                                                                              err += 'Group {0} is not available'.format(group)
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 384..387

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                          if __opts__['test']:
                                                                                                                                                                                                                                                                                                                                                              if isinstance(ret_perms, dict) and \
                                                                                                                                                                                                                                                                                                                                                                 'lmode' in ret_perms and \
                                                                                                                                                                                                                                                                                                                                                                 mode != ret_perms['lmode']:
                                                                                                                                                                                                                                                                                                                                                                  ret['comment'] = ('File {0} will be updated with permissions '
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 4115..4116

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                      if not ret['changes'] and ret['result']:
                                                                                                                                                                                                                                                                                                                                                          ret['comment'] = 'The directory {0} is in the correct state'.format(
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 40 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/file.py on lines 2810..2822

                                                                                                                                                                                                                                                                                                                                                  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

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

                                                                                                                                                                                                                                                                                                                                                                  if existing_data == merged_data:
                                                                                                                                                                                                                                                                                                                                                                      ret['result'] = True
                                                                                                                                                                                                                                                                                                                                                                      ret['comment'] = 'The file {0} is in the correct state'.format(name)
                                                                                                                                                                                                                                                                                                                                                                      return ret
                                                                                                                                                                                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 4 other locations - About 35 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/boto_s3.py on lines 256..259
                                                                                                                                                                                                                                                                                                                                                  salt/states/memcached.py on lines 73..76
                                                                                                                                                                                                                                                                                                                                                  salt/states/redismod.py on lines 149..152
                                                                                                                                                                                                                                                                                                                                                  salt/states/selinux.py on lines 112..115

                                                                                                                                                                                                                                                                                                                                                  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

                                                                                                                                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                                                                                                                                      existing_data = __serializers__[deserializer_name](
                                                                                                                                                                                                                                                                                                                                                                          fhr,
                                                                                                                                                                                                                                                                                                                                                                          **deserializer_options.get(deserializer_name, {})
                                                                                                                                                                                                                                                                                                                                                                      )
                                                                                                                                                                                                                                                                                                                                                  Severity: Minor
                                                                                                                                                                                                                                                                                                                                                  Found in salt/states/file.py and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                                                                                                                                                  salt/states/cabal.py on lines 86..91

                                                                                                                                                                                                                                                                                                                                                  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