hackedteam/vector-edk

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

Summary

Maintainability
F
1 mo
Test Coverage

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

def parse_makefile(fn, g=None):
    """Parse a Makefile-style file.

    A dictionary containing name/value pairs is returned.  If an
    optional dictionary is passed in as the second argument, it is
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.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 get_config_vars has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
Open

def get_config_vars(*args):
    """With no arguments, return a dictionary of all configuration
    variables relevant for the current platform.  Generally this includes
    everything needed to build extensions and install both pure modules and
    extensions.  On Unix, this means every variable defined in Python's
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 6 hrs to fix

Cognitive Complexity

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

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

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

Further reading

File sysconfig.py has 401 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Provide access to Python's configuration information.  The specific
configuration variables available depend heavily on the platform and
configuration.  The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys().  Additional convenience functions are also
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 5 hrs to fix

    Function get_python_lib has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_python_lib(plat_specific=0, standard_lib=0, prefix=None):
        """Return the directory containing the Python library (standard or
        site additions).
    
        If 'plat_specific' is true, return the directory containing
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.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 customize_compiler has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def customize_compiler(compiler):
        """Do any platform-specific customization of a CCompiler instance.
    
        Mainly needed on Unix, so we can plug in the information that
        varies across Unices and is stored in Python's Makefile.
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.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 _init_posix has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _init_posix():
        """Initialize the module as appropriate for POSIX systems."""
        g = {}
        # load the installed Makefile:
        try:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.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 parse_config_h has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_config_h(fp, g=None):
        """Parse a config.h-style file.
    
        A dictionary containing name/value pairs is returned.  If an
        optional dictionary is passed in as the second argument, it is
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function get_python_inc has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_python_inc(plat_specific=0, prefix=None):
        """Return the directory containing installed Python header files.
    
        If 'plat_specific' is false (the default), this is the path to the
        non-platform-specific header files, i.e. Python.h and so on;
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.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

                        for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
                            # a number of derived variables. These need to be
                            # patched up as well.
                            'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
    
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if not os.path.exists(sdk):
                              for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
                                   # a number of derived variables. These need to be
                                   # patched up as well.
                                  'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if "$" in after:
                                notdone[name] = value
                            else:
                                try: value = int(value)
                                except ValueError:
        Severity: Major
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 45 mins to fix

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

          def get_config_h_filename():
              """Return full pathname of installed pyconfig.h file."""
              if python_build:
                  if os.name == "nt":
                      inc_dir = os.path.join(project_base, "PC")
          Severity: Minor
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.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 os.path.join(prefix, "Lib")
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return os.path.join(prefix, "Lib", "site-packages")
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                              return os.path.join(prefix, "Lib", "site-packages")
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/sysconfig.py - About 30 mins to fix

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

                vector-uefi/fd/efi/StdLib/lib/python.27/distutils/sysconfig.py on lines 0..571

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

                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