hackedteam/vector-edk

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

Summary

Maintainability
F
1 mo
Test Coverage

Function get_platform has a Cognitive Complexity of 56 (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
    and version and the architecture (as supplied by 'os.uname()'),
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.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 byte_compile has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
Open

def byte_compile (py_files,
                  optimize=0, force=0,
                  prefix=None, base_dir=None,
                  verbose=1, dry_run=0,
                  direct=None):
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.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

File util.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""distutils.util

Miscellaneous utility functions -- anything that doesn't fit into
one of the other *util.py modules.
"""
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 5 hrs to fix

    Function split_quoted has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def split_quoted (s):
        """Split a string up according to Unix shell-like rules for quotes and
        backslashes.  In short: words are delimited by spaces, as long as those
        spaces are not escaped by a backslash, or inside a quoted string.
        Single and double quotes are equivalent, and the quote characters can
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.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 change_root has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def change_root (new_root, pathname):
        """Return 'pathname' with 'new_root' prepended.  If 'pathname' is
        relative, this is equivalent to "os.path.join(new_root,pathname)".
        Otherwise, it requires making 'pathname' relative and then joining the
        two, which is tricky on DOS/Windows and Mac OS.
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.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 byte_compile has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def byte_compile (py_files,
    Severity: Major
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if not dry_run:
                              compile(file, cfile, dfile)
                      else:
      Severity: Major
      Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 45 mins to fix

        Function execute has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def execute (func, args, msg=None, verbose=0, dry_run=0):
        Severity: Minor
        Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 35 mins to fix

          Avoid too many return statements within this function.
          Open

                  return  "%s-%s" % (osname, machine)
          Severity: Major
          Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return sys.platform
            Severity: Major
            Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return "%s-%s" % (osname, release)
              Severity: Major
              Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.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 AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return "%s-%s.%s" % (osname, version, release)
                  Severity: Major
                  Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 30 mins to fix

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

                    def convert_path (pathname):
                        """Return 'pathname' as a name that will work on the native filesystem,
                        i.e. split it on '/' and put it back together again using the current
                        directory separator.  Needed because filenames in the setup script are
                        always supplied in Unix style, and have to be converted to the local
                    Severity: Minor
                    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/util.py - About 25 mins to fix

                    Cognitive Complexity

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

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

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

                    Further reading

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

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

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

                    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