hackedteam/vector-edk

View on GitHub
AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.py

Summary

Maintainability
F
1 mo
Test Coverage

Function expandvars has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

def expandvars(path):
    """Expand shell variables of the forms $var, ${var} and %var%.

    Unknown variables are left unchanged."""
    if '$' not in path and '%' not in path:
Severity: Minor
Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.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 ntpath.py has 351 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Module 'ntpath' -- common operations on WinNT/Win95 pathnames
"""Common pathname manipulations, WindowsNT/95 version.

Instead of importing this module directly, import os and refer to this
module as os.path.
Severity: Minor
Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.py - About 4 hrs to fix

    Function join has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def join(a, *p):
        """Join two or more pathname components, inserting "\\" as needed.
        If any component is an absolute path, all previous path components
        will be discarded."""
        path = a
    Severity: Minor
    Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.py - About 4 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 normpath has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

    def normpath(path):
        """Normalize path, eliminating double slashes, etc."""
        # Preserve unicode (if path is unicode)
        backslash, dot = (u'\\', u'.') if isinstance(path, unicode) else ('\\', '.')
        if path.startswith(('\\\\.\\', '\\\\?\\')):
    Severity: Minor
    Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.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 relpath has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def relpath(path, start=curdir):
        """Return a relative version of a path"""
    
        if not path:
            raise ValueError("no path specified")
    Severity: Minor
    Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.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 expanduser has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

    def expanduser(path):
        """Expand ~ and ~user constructs.
    
        If user or $HOME is unknown, do nothing."""
        if path[:1] != '~':
    Severity: Minor
    Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.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 splitunc has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def splitunc(p):
        """Split a pathname into UNC mount point and relative path specifiers.
    
        Return a 2-tuple (unc, rest); either part may be empty.
        If unc is not empty, it has the form '//host/mount' (or similar
    Severity: Minor
    Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.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 abspath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def abspath(path):
            """Return the absolute version of a path."""
            if not isabs(path):
                if isinstance(path, unicode):
                    cwd = os.getcwdu()
    Severity: Minor
    Found in AppPkg/Applications/Python/PyMod-2.7.2/Lib/ntpath.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

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

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

    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