hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/Common/MigrationUtilities.py

Summary

Maintainability
C
7 hrs
Test Coverage

File MigrationUtilities.py has 262 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# Contains several utilitities shared by migration tools.
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
Severity: Minor
Found in BaseTools/Source/Python/Common/MigrationUtilities.py - About 2 hrs to fix

    Function GetSection has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetSection(SectionName, Method, ObjectList):
        SupportedArches = ["common", "Ia32", "X64", "Ipf", "Ebc", "ARM", "AARCH64"]
        SectionDict = {}
        for Object in ObjectList:
            Item = Method(Object)
    Severity: Minor
    Found in BaseTools/Source/Python/Common/MigrationUtilities.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 MigrationOptionParser has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

    def MigrationOptionParser(Source, Destinate, ToolName, VersionNumber = 1.0):
        # use clearer usage to override default usage message
        UsageString = "%s [-a] [-v|-q] [-o <output_file>] <input_file>" % ToolName
        Version = "%s Version %.2f" % (ToolName, VersionNumber)
        Copyright = "Copyright (c) 2007, Intel Corporation. All rights reserved."
    Severity: Minor
    Found in BaseTools/Source/Python/Common/MigrationUtilities.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 GetTextFileInfo has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetTextFileInfo(FileName, TagTuple):
        ValueTuple = [""] * len(TagTuple)
        try:
            for Line in open(FileName):
                Line = Line.split("#", 1)[0]
    Severity: Minor
    Found in BaseTools/Source/Python/Common/MigrationUtilities.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

    There are no issues that match your filters.

    Category
    Status