hackedteam/vector-edk

View on GitHub
vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py

Summary

Maintainability
F
1 mo
Test Coverage

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

def get_platform():
    """Return a string that identifies the current platform.

    This is used mainly to distinguish platform-specific build directories and
    platform-specific built distributions.  Typically includes the OS name
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.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 get_config_vars has a Cognitive Complexity of 55 (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.

    On Unix, this means every variable defined in Python's installed Makefile;
Severity: Minor
Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.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

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

"""Provide access to Python's configuration information.

"""
import sys
import os
Severity: Major
Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 1 day to fix

    Function _parse_makefile has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
    Open

    def _parse_makefile(filename, vars=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 vector-uefi/fd/efi/StdLib/lib/python.27/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 parse_config_h has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_config_h(fp, vars=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 vector-uefi/fd/efi/StdLib/lib/python.27/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

                        if "$" in after:
                            notdone[name] = value
                        else:
                            try: value = int(value)
                            except ValueError:
    Severity: Major
    Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          for key in ('LDFLAGS', 'BASECFLAGS',
                              # a number of derived variables. These need to be
                              # patched up as well.
                              'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
      
      Severity: Major
      Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 45 mins to fix

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

        def _getuserbase():
            env_base = os.environ.get("PYTHONUSERBASE", None)
            def joinuser(*args):
                return os.path.expanduser(os.path.join(*args))
        
        Severity: Minor
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 45 mins to fix

        Cognitive Complexity

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

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

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

        Further reading

        Avoid deeply nested control flow statements.
        Open

                            if not os.path.exists(sdk):
                                for key in ('LDFLAGS', 'BASECFLAGS',
                                     # a number of derived variables. These need to be
                                     # patched up as well.
                                    'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
        Severity: Major
        Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 45 mins to fix

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

          def _init_posix(vars):
              """Initialize the module as appropriate for POSIX systems."""
              # load the installed Makefile:
              makefile = _get_makefile_filename()
              try:
          Severity: Minor
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/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 "%s-%s.%s" % (osname, version, release)
          Severity: Major
          Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                return "%s-%s-%s" % (osname, release, machine)
            Severity: Major
            Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return  "%s-%s" % (osname, machine)
              Severity: Major
              Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return sys.platform
                Severity: Major
                Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return "%s-%s" % (osname, release)
                  Severity: Major
                  Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py - About 30 mins to fix

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

                    Severity: Major
                    Found in vector-uefi/fd/efi/StdLib/lib/python.27/sysconfig.py and 1 other location - About 1 mo to fix
                    AppPkg/Applications/Python/Python-2.7.2/Lib/sysconfig.py on lines 0..687

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

                    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