hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py

Summary

Maintainability
F
1 mo
Test Coverage

File install.py has 423 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""distutils.command.install

Implements the Distutils 'install' command."""

from distutils import log

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

        def finalize_options (self):
    
            # This method (and its pliant slaves, like 'finalize_unix()',
            # 'finalize_other()', and 'select_scheme()') is where the default
            # installation directories for modules, extension modules, and

    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 finalize_unix has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

        def finalize_unix (self):
    
            if self.install_base is not None or self.install_platbase is not None:
                if ((self.install_lib is None and
                     self.install_purelib is None and

    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

    install has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class install (Command):
    
        description = "install everything from build directory"
    
        user_options = [

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

          def run (self):
      
              # Obviously have to build before we can install
              if not self.skip_build:
                  self.run_command('build')

      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 dump_dirs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def dump_dirs (self, msg):
              if DEBUG:
                  from distutils.fancy_getopt import longopt_xlate
                  print msg + ":"
                  for opt in self.user_options:

      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 handle_extra_path has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_extra_path (self):
      
              if self.extra_path is None:
                  self.extra_path = self.distribution.extra_path
      
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function finalize_other has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def finalize_other (self):          # Windows and Mac OS for now
      
              if self.user:
                  if self.install_userbase is None:
                      raise DistutilsPlatformError(
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def get_outputs (self):
              # Assemble the outputs of all the sub-commands.
              outputs = []
              for cmd_name in self.get_sub_commands():
                  cmd = self.get_finalized_command(cmd_name)
      Severity: Minor
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py - About 45 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Consider simplifying this complex logical expression.
      Open

                  if ((self.install_lib is None and
                       self.install_purelib is None and
                       self.install_platlib is None) or
                      self.install_headers is None or
                      self.install_scripts is None or
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if self.user and (self.prefix or self.exec_prefix or self.home or
                        self.install_base or self.install_platbase):
                    raise DistutilsOptionError("can't combine user with with prefix/"
                                               "exec_prefix/home or install_(plat)base")
        
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.py - About 40 mins to fix

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

              def _expand_attrs (self, attrs):
                  for attr in attrs:
                      val = getattr(self, attr)
                      if val is not None:
                          if os.name == 'posix' or os.name == 'nt':
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/command/install.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

          vector-uefi/fd/efi/StdLib/lib/python.27/distutils/command/install.py on lines 0..669

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

          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