saltstack/salt

View on GitHub
salt/modules/pip.py

Summary

Maintainability
F
2 wks
Test Coverage

File pip.py has 1178 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv

Windows Support
Severity: Major
Found in salt/modules/pip.py - About 3 days to fix

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

    def install(pkgs=None,  # pylint: disable=R0912,R0913,R0914
                requirements=None,
                bin_env=None,
                use_wheel=False,
                no_use_wheel=False,
    Severity: Minor
    Found in salt/modules/pip.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 install. (106)
    Open

    def install(pkgs=None,  # pylint: disable=R0912,R0913,R0914
                requirements=None,
                bin_env=None,
                use_wheel=False,
                no_use_wheel=False,
    Severity: Minor
    Found in salt/modules/pip.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 _process_requirements has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring.
    Open

    def _process_requirements(requirements, cmd, cwd, saltenv, user):
        '''
        Process the requirements argument
        '''
        cleanup_requirements = []
    Severity: Minor
    Found in salt/modules/pip.py - About 1 day to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function uninstall has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    def uninstall(pkgs=None,
                  requirements=None,
                  bin_env=None,
                  log=None,
                  proxy=None,
    Severity: Minor
    Found in salt/modules/pip.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 list_ has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_(prefix=None,
              bin_env=None,
              user=None,
              cwd=None,
              env_vars=None,
    Severity: Minor
    Found in salt/modules/pip.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function _get_pip_bin has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _get_pip_bin(bin_env):
        '''
        Locate the pip binary, either from `bin_env` as a virtualenv, as the
        executable itself, or from searching conventional filesystem locations
        '''
    Severity: Minor
    Found in salt/modules/pip.py - About 3 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

    def list_upgrades(bin_env=None,
                      user=None,
                      cwd=None):
        '''
        Check whether or not an upgrade is available for all packages
    Severity: Minor
    Found in salt/modules/pip.py - About 2 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function list_all_versions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def list_all_versions(pkg,
                          bin_env=None,
                          include_alpha=False,
                          include_beta=False,
                          include_rc=False,
    Severity: Minor
    Found in salt/modules/pip.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 uninstall. (22)
    Open

    def uninstall(pkgs=None,
                  requirements=None,
                  bin_env=None,
                  log=None,
                  proxy=None,
    Severity: Minor
    Found in salt/modules/pip.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 _format_env_vars has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def _format_env_vars(env_vars):
        ret = {}
        if env_vars:
            if isinstance(env_vars, dict):
                for key, val in six.iteritems(env_vars):
    Severity: Minor
    Found in salt/modules/pip.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function is_installed has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_installed(pkgname=None,
                     bin_env=None,
                     user=None,
                     cwd=None):
        '''
    Severity: Minor
    Found in salt/modules/pip.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function install has 42 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def install(pkgs=None,  # pylint: disable=R0912,R0913,R0914
                requirements=None,
                bin_env=None,
                use_wheel=False,
                no_use_wheel=False,
    Severity: Minor
    Found in salt/modules/pip.py - About 1 hr to fix

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

      def upgrade(bin_env=None,
                  user=None,
                  cwd=None,
                  use_vt=False):
          '''
      Severity: Minor
      Found in salt/modules/pip.py - About 1 hr to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid deeply nested control flow statements.
      Open

                          if not os.path.exists(target_base):
                              os.makedirs(target_base, mode=0o755)
                              __salt__['file.chown'](target_base, user, None)
      
      
      Severity: Major
      Found in salt/modules/pip.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            for req in rq_:
                                req = salt.utils.stringutils.to_unicode(req)
                                try:
                                    req_pkg, _ = req.split('==')
                                    if req_pkg in pkgs:
        Severity: Major
        Found in salt/modules/pip.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if not os.path.isabs(req_file):
                                  req_file = os.path.join(cwd, req_file)
          
          
          Severity: Major
          Found in salt/modules/pip.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if not os.path.exists(target_path):
                                    logger.debug(
                                        'Copying %s to %s', req_file, target_path
                                    )
                                    __salt__['file.copy'](req_file, target_path)
            Severity: Major
            Found in salt/modules/pip.py - About 45 mins to fix

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

              def _get_env_activate(bin_env):
                  '''
                  Return the path to the activate binary
                  '''
                  if not bin_env:
              Severity: Minor
              Found in salt/modules/pip.py - About 35 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

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

              def freeze(bin_env=None,
                         user=None,
                         cwd=None,
                         use_vt=False,
                         env_vars=None,
              Severity: Minor
              Found in salt/modules/pip.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

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

                      elif line.startswith('-e'):
                          line = line.split('-e ')[1]
                          if '#egg=' in line:
                              version_, name = line.split('#egg=')
                          else:
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 7 hrs to fix
              salt/modules/pip.py on lines 1393..1404

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

              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

                      elif line.startswith('-e'):
                          line = line.split('-e ')[1]
                          version_, name = line.split('#egg=')
                      elif len(line.split('===')) >= 2:
                          name = line.split('===')[0]
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 7 hrs to fix
              salt/modules/pip.py on lines 1216..1235

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

              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 use_wheel:
                      min_version = '1.4'
                      max_version = '9.0.3'
                      too_low = salt.utils.versions.compare(ver1=cur_version, oper='<', ver2=min_version)
                      too_high = salt.utils.versions.compare(ver1=cur_version, oper='>', ver2=max_version)
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 4 hrs to fix
              salt/modules/pip.py on lines 685..697

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

              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 no_use_wheel:
                      min_version = '1.4'
                      max_version = '9.0.3'
                      too_low = salt.utils.versions.compare(ver1=cur_version, oper='<', ver2=min_version)
                      too_high = salt.utils.versions.compare(ver1=cur_version, oper='>', ver2=max_version)
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 4 hrs to fix
              salt/modules/pip.py on lines 671..683

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

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

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

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

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

              Refactorings

              Further Reading

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

                      if not isinstance(pkgs, list):
                          try:
                              pkgs = [p.strip() for p in pkgs.split(',')]
                          except AttributeError:
                              pkgs = [p.strip() for p in six.text_type(pkgs).split(',')]
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 3 hrs to fix
              salt/fileserver/__init__.py on lines 704..708

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

              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 timeout:
                      try:
                          if isinstance(timeout, float):
                              # Catch floating point input, exception will be caught in
                              # exception class below.
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 2 hrs to fix
              salt/modules/pip.py on lines 1050..1062

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

              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 timeout:
                      try:
                          if isinstance(timeout, float):
                              # Catch floating point input, exception will be caught in
                              # exception class below.
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 2 hrs to fix
              salt/modules/pip.py on lines 725..737

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

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

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

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

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

              Refactorings

              Further Reading

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

                  if global_options:
                      if isinstance(global_options, six.string_types):
                          global_options = [go.strip() for go in global_options.split(',')]
              
                      for opt in global_options:
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 859..864
              salt/modules/pip.py on lines 905..910
              salt/modules/pip.py on lines 912..918

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 56.

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

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

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

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

              Refactorings

              Further Reading

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

                  if allow_unverified:
                      if isinstance(allow_unverified, six.string_types):
                          allow_unverified = \
                              [p.strip() for p in allow_unverified.split(',')]
              
              
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 852..857
              salt/modules/pip.py on lines 859..864
              salt/modules/pip.py on lines 905..910

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 56.

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

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

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

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

              Refactorings

              Further Reading

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

                  if allow_external:
                      if isinstance(allow_external, six.string_types):
                          allow_external = [p.strip() for p in allow_external.split(',')]
              
                      for pkg in allow_external:
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 852..857
              salt/modules/pip.py on lines 859..864
              salt/modules/pip.py on lines 912..918

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 56.

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

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

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

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

              Refactorings

              Further Reading

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

                  if install_options:
                      if isinstance(install_options, six.string_types):
                          install_options = [io.strip() for io in install_options.split(',')]
              
                      for opt in install_options:
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 852..857
              salt/modules/pip.py on lines 905..910
              salt/modules/pip.py on lines 912..918

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 56.

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

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

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

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

              Refactorings

              Further Reading

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

                  if extra_index_url:
                      if not salt.utils.url.validate(extra_index_url, VALID_PROTOS):
                          raise CommandExecutionError(
                              '\'{0}\' is not a valid URL'.format(extra_index_url)
                          )
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 756..761
              salt/modules/pip.py on lines 1544..1549
              salt/modules/pip.py on lines 1551..1556

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

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

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

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

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

              Refactorings

              Further Reading

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

                  if index_url:
                      if not salt.utils.url.validate(index_url, VALID_PROTOS):
                          raise CommandExecutionError(
                              '\'{0}\' is not a valid URL'.format(index_url)
                          )
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 763..768
              salt/modules/pip.py on lines 1544..1549
              salt/modules/pip.py on lines 1551..1556

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

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

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

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

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

              Refactorings

              Further Reading

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

                  if index_url:
                      if not salt.utils.url.validate(index_url, VALID_PROTOS):
                          raise CommandExecutionError(
                              '\'{0}\' is not a valid URL'.format(index_url)
                          )
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 756..761
              salt/modules/pip.py on lines 763..768
              salt/modules/pip.py on lines 1551..1556

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

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

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

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

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

              Refactorings

              Further Reading

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

                  if extra_index_url:
                      if not salt.utils.url.validate(extra_index_url, VALID_PROTOS):
                          raise CommandExecutionError(
                              '\'{0}\' is not a valid URL'.format(extra_index_url)
                          )
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 1 hr to fix
              salt/modules/pip.py on lines 756..761
              salt/modules/pip.py on lines 763..768
              salt/modules/pip.py on lines 1544..1549

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

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

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

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

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

              Refactorings

              Further Reading

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

              def install(pkgs=None,  # pylint: disable=R0912,R0913,R0914
                          requirements=None,
                          bin_env=None,
                          use_wheel=False,
                          no_use_wheel=False,
              Severity: Major
              Found in salt/modules/pip.py and 1 other location - About 1 hr to fix
              salt/utils/http.py on lines 132..177

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

                      try:
                          pkgs = salt.utils.json.loads(result['stdout'], strict=False)
                      except ValueError:
                          raise CommandExecutionError('Invalid JSON', info=result)
              Severity: Major
              Found in salt/modules/pip.py and 3 other locations - About 45 mins to fix
              salt/modules/win_dsc.py on lines 85..88
              salt/modules/win_servermanager.py on lines 79..82
              salt/modules/win_wusa.py on lines 67..70

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

              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 salt.utils.platform.is_windows():
                          activate_bin = os.path.join(bin_env, 'Scripts', 'activate.bat')
                      else:
                          activate_bin = os.path.join(bin_env, 'bin', 'activate')
              Severity: Minor
              Found in salt/modules/pip.py and 1 other location - About 45 mins to fix
              salt/states/virtualenv_mod.py on lines 145..148

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

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

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

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

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

              Refactorings

              Further Reading

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

                  with salt.utils.files.fopen(link) as fh_link:
                      child_links = rex_pip_chain_read.findall(
                          salt.utils.stringutils.to_unicode(fh_link.read())
              Severity: Minor
              Found in salt/modules/pip.py and 1 other location - About 35 mins to fix
              salt/states/jenkins.py on lines 71..72

              Duplicated Code

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

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

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

              Tuning

              This issue has a mass of 41.

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

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

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

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

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status