saltstack/salt

View on GitHub
salt/states/git.py

Summary

Maintainability
F
1 mo
Test Coverage

Function latest has a Cognitive Complexity of 670 (exceeds 5 allowed). Consider refactoring.
Open

def latest(name,
           rev='HEAD',
           target=None,
           branch=None,
           user=None,
Severity: Minor
Found in salt/states/git.py - About 1 wk 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

File git.py has 2907 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
States to manage git repositories and git configuration

.. important::
Severity: Major
Found in salt/states/git.py - About 1 wk to fix

    Cyclomatic complexity is too high in function latest. (267)
    Open

    def latest(name,
               rev='HEAD',
               target=None,
               branch=None,
               user=None,
    Severity: Minor
    Found in salt/states/git.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 detached has a Cognitive Complexity of 130 (exceeds 5 allowed). Consider refactoring.
    Open

    def detached(name,
               rev,
               target=None,
               remote='origin',
               user=None,
    Severity: Minor
    Found in salt/states/git.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 detached. (71)
    Open

    def detached(name,
               rev,
               target=None,
               remote='origin',
               user=None,
    Severity: Minor
    Found in salt/states/git.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 cloned has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    def cloned(name,
               target=None,
               branch=None,
               user=None,
               password=None,
    Severity: Minor
    Found in salt/states/git.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 config_set has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def config_set(name,
                   value=None,
                   multivar=None,
                   repo=None,
                   user=None,
    Severity: Minor
    Found in salt/states/git.py - About 5 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function config_unset has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
    Open

    def config_unset(name,
                     value_regex=None,
                     repo=None,
                     user=None,
                     password=None,
    Severity: Minor
    Found in salt/states/git.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 present has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
    Open

    def present(name,
                force=False,
                bare=True,
                template=None,
                separate_git_dir=None,
    Severity: Minor
    Found in salt/states/git.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 mod_run_check has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def mod_run_check(cmd_kwargs, onlyif, unless):
        '''
        Execute the onlyif and unless logic. Return a result dict if:
    
        * onlyif failed (onlyif != 0)
    Severity: Minor
    Found in salt/states/git.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 cloned. (28)
    Open

    def cloned(name,
               target=None,
               branch=None,
               user=None,
               password=None,
    Severity: Minor
    Found in salt/states/git.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 config_unset. (27)
    Open

    def config_unset(name,
                     value_regex=None,
                     repo=None,
                     user=None,
                     password=None,
    Severity: Minor
    Found in salt/states/git.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 config_set. (26)
    Open

    def config_set(name,
                   value=None,
                   multivar=None,
                   repo=None,
                   user=None,
    Severity: Minor
    Found in salt/states/git.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 _not_fast_forward has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def _not_fast_forward(ret, rev, pre, post, branch, local_branch,
                          default_branch, local_changes, comments):
        branch_msg = ''
        if branch is None:
            if rev != 'HEAD':
    Severity: Minor
    Found in salt/states/git.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 present. (21)
    Open

    def present(name,
                force=False,
                bare=True,
                template=None,
                separate_git_dir=None,
    Severity: Minor
    Found in salt/states/git.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 latest has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def latest(name,
               rev='HEAD',
               target=None,
               branch=None,
               user=None,
    Severity: Minor
    Found in salt/states/git.py - About 1 hr to fix

      Function detached has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def detached(name,
                 rev,
                 target=None,
                 remote='origin',
                 user=None,
      Severity: Minor
      Found in salt/states/git.py - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if comments:
                                    msg += _format_comments(comments)
                                return _neutral_test(ret, msg)
        Severity: Major
        Found in salt/states/git.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if update_head:
                                      ret['changes']['revision'] = {
                                          'old': local_rev, 'new': remote_rev
                                      }
                                      if fast_forward is False:
          Severity: Major
          Found in salt/states/git.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    for tag_name in deleted_tags:
                                        try:
                                            if not __opts__['test']:
                                                __salt__['git.tag'](
                                                    target,
            Severity: Major
            Found in salt/states/git.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if __salt__['git.symbolic_ref'](
                                              target,
                                              'HEAD',
                                              opts=['--quiet'],
                                              user=user,
              Severity: Major
              Found in salt/states/git.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if rev == 'HEAD':
                                            checkout_rev = remote_rev
                                        else:
                                            checkout_rev = desired_upstream \
                                                if desired_upstream \
                Severity: Major
                Found in salt/states/git.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if rev in all_local_tags:
                                                  try:
                                                      local_tag_sha1 = __salt__['git.rev_parse'](
                                                          target,
                                                          rev + '^{commit}',
                  Severity: Major
                  Found in salt/states/git.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if branch not in \
                                                    __salt__['git.list_branches'](
                                                        target,
                                                        user=user,
                                                        password=password,
                    Severity: Major
                    Found in salt/states/git.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if not revs_match:
                                                  if update_head:
                                                      if fast_forward is True:
                                                          actions.append(
                                                              'Repository would be fast-forwarded from '
                      Severity: Major
                      Found in salt/states/git.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if exc.errno != errno.ENOENT:
                                                    removal_errors[target_path] = exc
                                        if removal_errors:
                        Severity: Major
                        Found in salt/states/git.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if git_ver >= _LooseVersion('1.8.0'):
                                                      upstream_action = 'Tracking branch was unset'
                                                      branch_opts = ['--unset-upstream']
                                                  else:
                                                      branch_opts = None
                          Severity: Major
                          Found in salt/states/git.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if not revs_match \
                                                            and not update_head \
                                                            and formatted_actions:
                                                        ret['comment'] = formatted_actions
                                                        return ret
                            Severity: Major
                            Found in salt/states/git.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                          if remote in remotes:
                                                              try:
                                                                  # Do a rev-parse on <remote>/<rev> to get
                                                                  # the local SHA1 for it, so we can compare
                                                                  # it to the remote_rev SHA1.
                              Severity: Major
                              Found in salt/states/git.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if exc.errno != errno.ENOENT:
                                                            removal_errors[target_path] = exc
                                                if removal_errors:
                                Severity: Major
                                Found in salt/states/git.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if not revs_match and not update_head:
                                                              # Repo content would not be modified but the remote
                                                              # URL would be modified, so we can't just say that
                                                              # the repo is up-to-date, we need to inform the
                                                              # user of the actions taken.
                                  Severity: Major
                                  Found in salt/states/git.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if branch not in all_local_branches:
                                                                actions.append(
                                                                    'New branch \'{0}\' would be checked '
                                                                    'out, with {1} as a starting '
                                                                    'point'.format(branch, remote_loc)
                                    Severity: Major
                                    Found in salt/states/git.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              if ret['changes'].get('deleted_tags'):
                                                                  comments.append(
                                                                      'The following tags {0} removed from the local '
                                                                      'checkout: {1}'.format(
                                                                          'would be' if __opts__['test']
                                      Severity: Major
                                      Found in salt/states/git.py - About 45 mins to fix

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

                                        def _revs_equal(rev1, rev2, rev_type):
                                            '''
                                            Shorthand helper function for comparing SHA1s. If rev_type == 'sha1' then
                                            the comparison will be done using str.startwith() to allow short SHA1s to
                                            compare successfully.
                                        Severity: Minor
                                        Found in salt/states/git.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 _fail(
                                        Severity: Major
                                        Found in salt/states/git.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

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

                                            Avoid too many return statements within this function.
                                            Open

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

                                              Avoid too many return statements within this function.
                                              Open

                                                          return _fail(ret, 'identity must be either a list or a string')
                                              Severity: Major
                                              Found in salt/states/git.py - About 30 mins to fix

                                                Avoid too many return statements within this function.
                                                Open

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

                                                  Avoid too many return statements within this function.
                                                  Open

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

                                                    Avoid too many return statements within this function.
                                                    Open

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

                                                      Avoid too many return statements within this function.
                                                      Open

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

                                                        Avoid too many return statements within this function.
                                                        Open

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

                                                          Avoid too many return statements within this function.
                                                          Open

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

                                                            Avoid too many return statements within this function.
                                                            Open

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

                                                              Avoid too many return statements within this function.
                                                              Open

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

                                                                Avoid too many return statements within this function.
                                                                Open

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

                                                                  Avoid too many return statements within this function.
                                                                  Open

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

                                                                    Avoid too many return statements within this function.
                                                                    Open

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

                                                                      Avoid too many return statements within this function.
                                                                      Open

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

                                                                        Avoid too many return statements within this function.
                                                                        Open

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

                                                                          Avoid too many return statements within this function.
                                                                          Open

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

                                                                            Avoid too many return statements within this function.
                                                                            Open

                                                                                                    return _neutral_test(ret, msg)
                                                                            Severity: Major
                                                                            Found in salt/states/git.py - About 30 mins to fix

                                                                              Avoid too many return statements within this function.
                                                                              Open

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

                                                                                Avoid too many return statements within this function.
                                                                                Open

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

                                                                                  Avoid too many return statements within this function.
                                                                                  Open

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

                                                                                    Avoid too many return statements within this function.
                                                                                    Open

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

                                                                                      Avoid too many return statements within this function.
                                                                                      Open

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

                                                                                        Avoid too many return statements within this function.
                                                                                        Open

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

                                                                                          Avoid too many return statements within this function.
                                                                                          Open

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

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

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

                                                                                              Avoid too many return statements within this function.
                                                                                              Open

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

                                                                                                Avoid too many return statements within this function.
                                                                                                Open

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

                                                                                                  Avoid too many return statements within this function.
                                                                                                  Open

                                                                                                                          return _uptodate(ret, target, msg)
                                                                                                  Severity: Major
                                                                                                  Found in salt/states/git.py - About 30 mins to fix

                                                                                                    Avoid too many return statements within this function.
                                                                                                    Open

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

                                                                                                      Avoid too many return statements within this function.
                                                                                                      Open

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

                                                                                                        Avoid too many return statements within this function.
                                                                                                        Open

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

                                                                                                          Avoid too many return statements within this function.
                                                                                                          Open

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

                                                                                                            Avoid too many return statements within this function.
                                                                                                            Open

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

                                                                                                              Avoid too many return statements within this function.
                                                                                                              Open

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

                                                                                                                Avoid too many return statements within this function.
                                                                                                                Open

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

                                                                                                                  Avoid too many return statements within this function.
                                                                                                                  Open

                                                                                                                                  return _already_cloned(ret, target, branch, comments)
                                                                                                                  Severity: Major
                                                                                                                  Found in salt/states/git.py - About 30 mins to fix

                                                                                                                    Avoid too many return statements within this function.
                                                                                                                    Open

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

                                                                                                                      Avoid too many return statements within this function.
                                                                                                                      Open

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

                                                                                                                        Avoid too many return statements within this function.
                                                                                                                        Open

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

                                                                                                                          Avoid too many return statements within this function.
                                                                                                                          Open

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

                                                                                                                            Avoid too many return statements within this function.
                                                                                                                            Open

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

                                                                                                                              Avoid too many return statements within this function.
                                                                                                                              Open

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

                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                Open

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

                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                  Open

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

                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                    Open

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

                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                      Open

                                                                                                                                              return _fail(ret, ('\'rev\' is not compatible with the \'mirror\' and '
                                                                                                                                      Severity: Major
                                                                                                                                      Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                        Open

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

                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                          Open

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

                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                            Open

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

                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                              Open

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

                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                Open

                                                                                                                                                        return _fail(ret, exc.__str__())
                                                                                                                                                Severity: Major
                                                                                                                                                Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                  Open

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

                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                    Open

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

                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                      Open

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

                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                        Open

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

                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                          Open

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

                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                            Open

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

                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                              Open

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

                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                Open

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

                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                  Open

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

                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                    Open

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

                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                      Open

                                                                                                                                                                                  return _fail(ret, 'Identity must be either a list or a string')
                                                                                                                                                                      Severity: Major
                                                                                                                                                                      Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                        Open

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

                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                          Open

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

                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                            Open

                                                                                                                                                                                        return _neutral_test(ret, comment)
                                                                                                                                                                            Severity: Major
                                                                                                                                                                            Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                              Open

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

                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                Open

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

                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                  Open

                                                                                                                                                                                                          return _neutral_test(ret, msg)
                                                                                                                                                                                  Severity: Major
                                                                                                                                                                                  Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                    Open

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

                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                      Open

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

                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                        Open

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

                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                          Open

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

                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                            Open

                                                                                                                                                                                                        return _fail(ret, 'Failed to update repository', comments)
                                                                                                                                                                                            Severity: Major
                                                                                                                                                                                            Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                              Open

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

                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                Open

                                                                                                                                                                                                        return _neutral_test(ret, msg)
                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                    Open

                                                                                                                                                                                                                            return _fail(ret, msg % 'Repository', comments)  # pylint: disable=E1321
                                                                                                                                                                                                    Severity: Major
                                                                                                                                                                                                    Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                      Open

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

                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                            Open

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

                                                                                                                                                                                                              Avoid too many return statements within this function.
                                                                                                                                                                                                              Open

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

                                                                                                                                                                                                                Avoid too many return statements within this function.
                                                                                                                                                                                                                Open

                                                                                                                                                                                                                            return _already_cloned(ret, target, branch, comments)
                                                                                                                                                                                                                Severity: Major
                                                                                                                                                                                                                Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                                                                  Avoid too many return statements within this function.
                                                                                                                                                                                                                  Open

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

                                                                                                                                                                                                                    Avoid too many return statements within this function.
                                                                                                                                                                                                                    Open

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

                                                                                                                                                                                                                      Avoid too many return statements within this function.
                                                                                                                                                                                                                      Open

                                                                                                                                                                                                                              return _fail(ret, exc.__str__())
                                                                                                                                                                                                                      Severity: Major
                                                                                                                                                                                                                      Found in salt/states/git.py - About 30 mins to fix

                                                                                                                                                                                                                        Avoid too many return statements within this function.
                                                                                                                                                                                                                        Open

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

                                                                                                                                                                                                                          Avoid too many return statements within this function.
                                                                                                                                                                                                                          Open

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

                                                                                                                                                                                                                            Avoid too many return statements within this function.
                                                                                                                                                                                                                            Open

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

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

                                                                                                                                                                                                                              def _get_branch_opts(branch, local_branch, all_local_branches,
                                                                                                                                                                                                                                                   desired_upstream, git_ver=None):
                                                                                                                                                                                                                                  '''
                                                                                                                                                                                                                                  DRY helper to build list of opts for git.branch, for the purposes of
                                                                                                                                                                                                                                  setting upstream tracking branch
                                                                                                                                                                                                                              Severity: Minor
                                                                                                                                                                                                                              Found in salt/states/git.py - About 25 mins to fix

                                                                                                                                                                                                                              Cognitive Complexity

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

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

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

                                                                                                                                                                                                                              Further reading

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

                                                                                                                                                                                                                                              for target_object in target_contents:
                                                                                                                                                                                                                                                  target_path = os.path.join(target, target_object)
                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                      salt.utils.files.rm_rf(target_path)
                                                                                                                                                                                                                                                  except OSError as exc:
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2543..2549

                                                                                                                                                                                                                              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

                                                                                                                                                                                                                                              for target_object in target_contents:
                                                                                                                                                                                                                                                  target_path = os.path.join(target, target_object)
                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                      salt.utils.files.rm_rf(target_path)
                                                                                                                                                                                                                                                  except OSError as exc:
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 3 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1792..1798

                                                                                                                                                                                                                              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 target is not None:
                                                                                                                                                                                                                                      if not isinstance(target, six.string_types):
                                                                                                                                                                                                                                          target = six.text_type(target)
                                                                                                                                                                                                                                      if not os.path.isabs(target):
                                                                                                                                                                                                                                          return _fail(
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 661..667

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

                                                                                                                                                                                                                              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 target is not None:
                                                                                                                                                                                                                                      if not isinstance(target, six.string_types):
                                                                                                                                                                                                                                          target = six.text_type(target)
                                                                                                                                                                                                                                      if not os.path.isabs(target):
                                                                                                                                                                                                                                          return _fail(
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2370..2376

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

                                                                                                                                                                                                                              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 removal_errors:
                                                                                                                                                                                                                                                  err_strings = [
                                                                                                                                                                                                                                                      '  {0}\n    {1}'.format(k, v)
                                                                                                                                                                                                                                                      for k, v in six.iteritems(removal_errors)
                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2550..2558

                                                                                                                                                                                                                              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 removal_errors:
                                                                                                                                                                                                                                                  err_strings = [
                                                                                                                                                                                                                                                      '  {0}\n    {1}'.format(k, v)
                                                                                                                                                                                                                                                      for k, v in six.iteritems(removal_errors)
                                                                                                                                                                                                                                                  ]
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1799..1807

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

                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          clone_opts = ['--mirror'] if mirror else ['--bare'] if bare else []
                                                                                                                                                                                                                                          if remote != 'origin':
                                                                                                                                                                                                                                              clone_opts.extend(['--origin', remote])
                                                                                                                                                                                                                                          if depth is not None:
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 2 other locations - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 897..1754
                                                                                                                                                                                                                              salt/states/git.py on lines 2580..2606

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 58.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          clone_opts = ['--no-checkout']
                                                                                                                                                                                                                                          if remote != 'origin':
                                                                                                                                                                                                                                              clone_opts.extend(['--origin', remote])
                                                                                                                                                                                                                              
                                                                                                                                                                                                                              
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 2 other locations - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 897..1754
                                                                                                                                                                                                                              salt/states/git.py on lines 1830..2053

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 58.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          all_local_branches = __salt__['git.list_branches'](
                                                                                                                                                                                                                                              target,
                                                                                                                                                                                                                                              user=user,
                                                                                                                                                                                                                                              password=password,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 2 other locations - About 2 hrs to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1830..2053
                                                                                                                                                                                                                              salt/states/git.py on lines 2580..2606

                                                                                                                                                                                                                              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 value_regex is None:
                                                                                                                                                                                                                                      pre = pre_matches
                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                      # Get all keys matching the key expression, so we can accurately report
                                                                                                                                                                                                                                      # on changes made.
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 3194..3205

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 57.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                  if value_regex is None:
                                                                                                                                                                                                                                      post_matches = post
                                                                                                                                                                                                                                  else:
                                                                                                                                                                                                                                      post_matches = __salt__['git.config_get_regexp'](
                                                                                                                                                                                                                                          cwd=repo,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 3130..3143

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 57.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                                  if branch_opts is not None:
                                                                                                                                                                                                                                                      __salt__['git.branch'](
                                                                                                                                                                                                                                                          target,
                                                                                                                                                                                                                                                          opts=branch_opts,
                                                                                                                                                                                                                                                          user=user,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1613..1620

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 45.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                              if branch_opts is not None:
                                                                                                                                                                                                                                                  __salt__['git.branch'](
                                                                                                                                                                                                                                                      target,
                                                                                                                                                                                                                                                      opts=branch_opts,
                                                                                                                                                                                                                                                      user=user,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2012..2019

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 45.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                          if base_branch is None:
                                                                                                                                                                                                                                              # No local branch, no upstream tracking branch
                                                                                                                                                                                                                                              upstream = None
                                                                                                                                                                                                                                          else:
                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1954..1964

                                                                                                                                                                                                                              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

                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                      upstream = __salt__['git.rev_parse'](
                                                                                                                                                                                                                                                          target,
                                                                                                                                                                                                                                                          local_branch + '@{upstream}',
                                                                                                                                                                                                                                                          opts=['--abbrev-ref'],
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1171..1193

                                                                                                                                                                                                                              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

                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                      desired_fetch_url = salt.utils.url.add_http_basic_auth(
                                                                                                                                                                                                                                          name,
                                                                                                                                                                                                                                          https_user,
                                                                                                                                                                                                                                          https_pass,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2419..2427

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 42.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                      desired_fetch_url = salt.utils.url.add_http_basic_auth(
                                                                                                                                                                                                                                          name,
                                                                                                                                                                                                                                          https_user,
                                                                                                                                                                                                                                          https_pass,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 723..731

                                                                                                                                                                                                                              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

                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                      local_branch = __salt__['git.current_branch'](
                                                                                                                                                                                                                                          target,
                                                                                                                                                                                                                                          user=user,
                                                                                                                                                                                                                                          password=password,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 118..127

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

                                                                                                                                                                                                                              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:
                                                                                                                                                                                                                                      local_rev = __salt__['git.revision'](
                                                                                                                                                                                                                                          target,
                                                                                                                                                                                                                                          user=user,
                                                                                                                                                                                                                                          password=password,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 130..139

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

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

                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              new_rev = __salt__['git.revision'](
                                                                                                                                                                                                                                                  cwd=target,
                                                                                                                                                                                                                                                  user=user,
                                                                                                                                                                                                                                                  password=password,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 2 other locations - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2034..2042
                                                                                                                                                                                                                              salt/states/git.py on lines 2730..2738

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 41.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          new_rev = __salt__['git.revision'](
                                                                                                                                                                                                                                              cwd=target,
                                                                                                                                                                                                                                              user=user,
                                                                                                                                                                                                                                              password=password,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 2 other locations - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1735..1743
                                                                                                                                                                                                                              salt/states/git.py on lines 2034..2042

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 41.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                          try:
                                                                                                                                                                                                                                              new_rev = __salt__['git.revision'](
                                                                                                                                                                                                                                                  cwd=target,
                                                                                                                                                                                                                                                  user=user,
                                                                                                                                                                                                                                                  password=password,
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 2 other locations - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1735..1743
                                                                                                                                                                                                                              salt/states/git.py on lines 2730..2738

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 41.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                  if comments:
                                                                                                                                                                                                                                      # Shouldn't be making any changes if the repo was up to date, but
                                                                                                                                                                                                                                      # report on them so we are alerted to potential problems with our
                                                                                                                                                                                                                                      # logic.
                                                                                                                                                                                                                                      ret['comment'] += (
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 192..196

                                                                                                                                                                                                                              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

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

                                                                                                                                                                                                                                  if comments:
                                                                                                                                                                                                                                      ret['comment'] += (
                                                                                                                                                                                                                                          '\n\nChanges {0}made: {1}'.format(
                                                                                                                                                                                                                                              'that would be ' if __opts__['test'] else '',
                                                                                                                                                                                                                                              _format_comments(comments)
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 159..166

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 40.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                      all_remote_refs = __salt__['git.remote_refs'](
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 1 hr to fix
                                                                                                                                                                                                                              salt/states/virt.py on lines 427..427

                                                                                                                                                                                                                              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

                                                                                                                                                                                                                                                  elif desired_upstream and upstream != desired_upstream:
                                                                                                                                                                                                                                                      upstream_action = (
                                                                                                                                                                                                                                                          'Tracking branch was updated to {0}'.format(
                                                                                                                                                                                                                                                              desired_upstream
                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                              Severity: Minor
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 55 mins to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1966..1981

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 45.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                                  if not upstream and desired_upstream:
                                                                                                                                                                                                                                                      upstream_action = (
                                                                                                                                                                                                                                                          'Tracking branch was set to {0}'.format(
                                                                                                                                                                                                                                                              desired_upstream
                                                                                                                                                                                                                                                          )
                                                                                                                                                                                                                              Severity: Minor
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 55 mins to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 1993..2008

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 45.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

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

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

                                                                                                                                                                                                                                              try:
                                                                                                                                                                                                                                                  fetch_changes = __salt__['git.fetch'](
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 5 other locations - About 30 mins to fix
                                                                                                                                                                                                                              salt/states/boto_secgroup.py on lines 699..699
                                                                                                                                                                                                                              salt/states/boto_secgroup.py on lines 735..735
                                                                                                                                                                                                                              salt/states/git.py on lines 1468..1469
                                                                                                                                                                                                                              salt/states/git.py on lines 2622..2623
                                                                                                                                                                                                                              salt/states/pip_state.py on lines 268..268

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 40.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                      try:
                                                                                                                                                                                                                                          fetch_changes = __salt__['git.fetch'](
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 5 other locations - About 30 mins to fix
                                                                                                                                                                                                                              salt/states/boto_secgroup.py on lines 699..699
                                                                                                                                                                                                                              salt/states/boto_secgroup.py on lines 735..735
                                                                                                                                                                                                                              salt/states/git.py on lines 1468..1469
                                                                                                                                                                                                                              salt/states/git.py on lines 1713..1714
                                                                                                                                                                                                                              salt/states/pip_state.py on lines 268..268

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 40.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                                  try:
                                                                                                                                                                                                                                                      fetch_changes = __salt__['git.fetch'](
                                                                                                                                                                                                                              Severity: Major
                                                                                                                                                                                                                              Found in salt/states/git.py and 5 other locations - About 30 mins to fix
                                                                                                                                                                                                                              salt/states/boto_secgroup.py on lines 699..699
                                                                                                                                                                                                                              salt/states/boto_secgroup.py on lines 735..735
                                                                                                                                                                                                                              salt/states/git.py on lines 1713..1714
                                                                                                                                                                                                                              salt/states/git.py on lines 2622..2623
                                                                                                                                                                                                                              salt/states/pip_state.py on lines 268..268

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 40.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                      if isinstance(identity, six.string_types):
                                                                                                                                                                                                                                          identity = [identity]
                                                                                                                                                                                                                                      elif not isinstance(identity, list):
                                                                                                                                                                                                                                          return _fail(ret, 'identity must be either a list or a string')
                                                                                                                                                                                                                              Severity: Minor
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 2383..2386

                                                                                                                                                                                                                              Duplicated Code

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

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

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

                                                                                                                                                                                                                              Tuning

                                                                                                                                                                                                                              This issue has a mass of 40.

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

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

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

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

                                                                                                                                                                                                                              Refactorings

                                                                                                                                                                                                                              Further Reading

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

                                                                                                                                                                                                                                      if isinstance(identity, six.string_types):
                                                                                                                                                                                                                                          identity = [identity]
                                                                                                                                                                                                                                      elif not isinstance(identity, list):
                                                                                                                                                                                                                                          return _fail(ret, 'Identity must be either a list or a string')
                                                                                                                                                                                                                              Severity: Minor
                                                                                                                                                                                                                              Found in salt/states/git.py and 1 other location - About 30 mins to fix
                                                                                                                                                                                                                              salt/states/git.py on lines 678..681

                                                                                                                                                                                                                              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