hackedteam/vector-edk

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

Summary

Maintainability
D
2 days
Test Coverage

File site.py has 497 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""Append module search paths for third-party packages to sys.path.

****************************************************************
* This module is automatically imported during initialization. *
****************************************************************
Severity: Minor
Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.py - About 7 hrs to fix

    Function addpackage has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def addpackage(sitedir, name, known_paths):
        """Process a .pth file within the site-packages directory:
           For each line in the file, either combine it with sitedir to a path
           and add that to known_paths, or execute it if it starts with 'import '.
        """
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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 _script has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def _script():
        help = """\
        %s [--user-base] [--user-site]
    
        Without arguments print some useful information
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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 getsitepackages has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def getsitepackages():
        """Returns a list containing all global site-packages directories
        (and possibly site-python).
    
        For each directory present in the global ``PREFIXES``, this function
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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 __call__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self):
            self.__setup()
            prompt = 'Hit Return for more, or q (and Return) to quit: '
            lineno = 0
            while 1:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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 __setup has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        def __setup(self):
            if self.__lines:
                return
            data = None
            for dir in self.__dirs:
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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 check_enableusersite has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_enableusersite():
        """Check if user site directory is safe for inclusion
    
        The function tests for the command line flag (including environment var),
        process uid/gid equal to effective uid/gid.
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

    def main():
        global ENABLE_USER_SITE
    
        abs__file__()
        known_paths = removeduppaths()
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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

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

    def aliasmbcs():
        """On Windows, some default encodings are not provided by Python,
        while they are always available as "mbcs" in each locale. Make
        them usable by aliasing to "mbcs" in such a case."""
        if sys.platform == 'win32':
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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

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

    def addsitedir(sitedir, known_paths=None):
        """Add 'sitedir' argument to sys.path if missing and handle .pth files in
        'sitedir'"""
        if known_paths is None:
            known_paths = _init_pathinfo()
    Severity: Minor
    Found in AppPkg/Applications/Python/Python-2.7.2/Lib/site.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

    There are no issues that match your filters.

    Category
    Status