hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/UPT/Library/Misc.py

Summary

Maintainability
F
3 wks
Test Coverage

File Misc.py has 570 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# Common routines used by all tools
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
Severity: Major
Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 1 day to fix

    Function ProcessEdkComment has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

    def ProcessEdkComment(LineList):
        FindEdkBlockComment = False
        Count = 0
        StartPos = -1
        EndPos = -1
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/Misc.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 GetFiles has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetFiles(Root, SkipList=None, FullPath=True):
        OriPath = os.path.normpath(Root)
        FileList = []
        for Root, Dirs, Files in walk(Root):
            if SkipList:
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 3 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 GetLibInstanceInfo has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetLibInstanceInfo(String, WorkSpace, LineNo):
    
        FileGuidString = ""
        VerString = ""
    
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/Misc.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 __init__ has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False,
                     Arch='COMMON', ToolChainFamily='', Target='', TagName='', \
                     ToolCode=''):
            self.Arch = Arch
            self.File = str(File)
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/Misc.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 Validate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def Validate(self, Type='', CaseSensitive=True):
            if GlobalData.gCASE_INSENSITIVE:
                CaseSensitive = False
            if Type and Type.lower() != self.Type:
                return ToolError.FILE_TYPE_MISMATCH, '%s (expect %s but got %s)' % \
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/Misc.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 RealPath2 has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def RealPath2(File, Dir='', OverrideDir=''):
        if OverrideDir:
            NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join\
                                                            (OverrideDir, File))]
            if NewFile:
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/Library/Misc.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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False,
    Severity: Major
    Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 1 hr to fix

      Function RemoveDirectory has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

      def RemoveDirectory(Directory, Recursively=False):
          if Directory == None or Directory.strip() == "" or not \
          os.path.exists(Directory):
              return
          if Recursively:
      Severity: Minor
      Found in BaseTools/Source/Python/UPT/Library/Misc.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 ConvertVersionToDecimal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def ConvertVersionToDecimal(StringIn):
          if IsValidHexVersion(StringIn):
              Value = int(StringIn, 16)
              Major = Value >> 16
              Minor = Value & 0xFFFF
      Severity: Minor
      Found in BaseTools/Source/Python/UPT/Library/Misc.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 (Count == StartPos) and Line.strip() == '/*/':
                              Count = Count + 1
                              continue
                          EndPos = Count
      Severity: Major
      Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 45 mins to fix

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

        def SaveFileOnChange(File, Content, IsBinaryFile=True):
            if not IsBinaryFile:
                Content = Content.replace("\n", linesep)
        
            if os.path.exists(File):
        Severity: Minor
        Found in BaseTools/Source/Python/UPT/Library/Misc.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 IsEqualList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def IsEqualList(ListA, ListB):
            if ListA == ListB:
                return True
        
            for ItemA in ListA:
        Severity: Minor
        Found in BaseTools/Source/Python/UPT/Library/Misc.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 None, None
        Severity: Major
        Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return NewFile, ''
          Severity: Major
          Found in BaseTools/Source/Python/UPT/Library/Misc.py - About 30 mins to fix

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

            def GetHelpStringByRemoveHashKey(String):
                ReturnString = ''
                PattenRemoveHashKey = re.compile(r"^[#+\s]+", re.DOTALL)
                String = String.strip()
                if String == '':
            Severity: Minor
            Found in BaseTools/Source/Python/UPT/Library/Misc.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 update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def update(self, Dict=None, **Kwargs):
                    if Dict != None:
                        for Key1, Val1 in Dict.items():
                            self[Key1] = Val1
                    if len(Kwargs):
            Severity: Minor
            Found in BaseTools/Source/Python/UPT/Library/Misc.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 ConvertPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

            def ConvertPath(Path):
                RetPath = ''
                for Char in Path.strip():
                    if Char.isalnum() or Char in '.-_/':
                        RetPath = RetPath + Char
            Severity: Minor
            Found in BaseTools/Source/Python/UPT/Library/Misc.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

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

            class Sdict(IterableUserDict):
                ## Constructor
                #
                def __init__(self):
                    IterableUserDict.__init__(self)
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 wk to fix
            BaseTools/Source/Python/Common/Misc.py on lines 859..973

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

            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

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

                def __init__(self, File='', Root='', AlterRoot='', Type='', IsBinary=False,
                             Arch='COMMON', ToolChainFamily='', Target='', TagName='', \
                             ToolCode=''):
                    self.Arch = Arch
                    self.File = str(File)
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 4 days to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1459..1507

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

            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

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

            def GuidStringToGuidStructureString(Guid):
                GuidList = Guid.split('-')
                Result = '{'
                for Index in range(0, 3, 1):
                    Result = Result + '0x' + GuidList[Index] + ', '
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 day to fix
            BaseTools/Source/Python/Common/Misc.py on lines 77..86

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

            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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                try:
                    return "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" % (
                            int(GuidValueList[0], 16),
                            int(GuidValueList[1], 16),
                            int(GuidValueList[2], 16),
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 2 other locations - About 1 day to fix
            BaseTools/Source/Python/Common/Misc.py on lines 134..146
            BaseTools/Source/Python/Common/Misc.py on lines 162..173

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

            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

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

            def CommonPath(PathList):
                Path1 = min(PathList).split(os.path.sep)
                Path2 = max(PathList).split(os.path.sep)
                for Index in xrange(min(len(Path1), len(Path2))):
                    if Path1[Index] != Path2[Index]:
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 7 hrs to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1450..1456

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

            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

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

                if OverrideDir:
                    NewFile = GlobalData.gALL_FILES[os.path.normpath(os.path.join\
                                                                    (OverrideDir, File))]
                    if NewFile:
                        if OverrideDir[-1] == os.path.sep:
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 7 hrs to fix
            BaseTools/Source/Python/Common/Misc.py on lines 443..449

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

            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

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

                if NewFile:
                    if Dir:
                        if Dir[-1] == os.path.sep:
                            return NewFile[len(Dir):], NewFile[0:len(Dir)]
                        else:
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 6 hrs to fix
            BaseTools/Source/Python/Common/Misc.py on lines 454..461

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

            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

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

            def RealPath(File, Dir='', OverrideDir=''):
                NewFile = os.path.normpath(os.path.join(Dir, File))
                NewFile = GlobalData.gALL_FILES[NewFile]
                if not NewFile and OverrideDir:
                    NewFile = os.path.normpath(os.path.join(OverrideDir, File))
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 5 hrs to fix
            BaseTools/Source/Python/Common/Misc.py on lines 434..440

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

            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

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

                def __eq__(self, Other):
                    if type(Other) == type(self):
                        return self.Path == Other.Path
                    else:
                        return self.Path == str(Other)
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 2 hrs to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1525..1529

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

            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

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

                        if self.AlterRoot:
                            RealFile = os.path.join(self.AlterRoot, self.File)
                        elif self.Root:
                            RealFile = os.path.join(self.Root, self.File)
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 hr to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1578..1581

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

            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

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

                        try:
                            FileLinesList = FInputfile.readlines()
                        except BaseException:
                            Logger.Error("InfParser",
                                         ToolError.FILE_READ_FAILURE,
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 hr to fix
            BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py on lines 220..225

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

            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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                if not (ValidFile(FullFileName)):
                    Logger.Error("InfParser",
                                 ToolError.FORMAT_INVALID,
                                 ST.ERR_FILELIST_EXIST % (String),
                                 File=GlobalData.gINF_MODULE_NAME,
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 2 other locations - About 1 hr to fix
            BaseTools/Source/Python/UPT/Object/Parser/InfPcdObject.py on lines 51..56
            BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py on lines 196..200

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

            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

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

                if ReturnString.endswith('\n') and not ReturnString.endswith('\n\n') and ReturnString != '\n':
                    ReturnString = ReturnString[:-1]
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 hr to fix
            BaseTools/Source/Python/UPT/Library/CommentParsing.py on lines 185..186

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

            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

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

                        if CaseSensitive and (RealFile != self.File or \
                                              (RealRoot != self.Root and RealRoot != \
                                               self.AlterRoot)):
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 hr to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1587..1587

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

            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

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

                if Directory == None or Directory.strip() == "" or not \
                os.path.exists(Directory):
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 1 hr to fix
            BaseTools/Source/Python/Common/Misc.py on lines 195..195

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

            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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                GuidValueString = GuidValue.lower().replace("{", "").replace("}", "").\
                replace(" ", "").replace(";", "")
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 2 other locations - About 55 mins to fix
            BaseTools/Source/Python/Common/Misc.py on lines 95..95
            BaseTools/Source/Python/Common/Misc.py on lines 129..129

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

            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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

                    for Line in FileLinesList:
                        if ReFileGuidPattern.match(Line):
                            FileGuidString = Line
                        if ReVerStringPattern.match(Line):
                            VerString = Line
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 2 other locations - About 50 mins to fix
            BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py on lines 88..92
            BaseTools/Source/Python/UPT/Parser/InfAsBuiltProcess.py on lines 278..282

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

            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

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

                def _GetFileKey(self):
                    if self._Key == None:
                        self._Key = self.Path.upper()
                    return self._Key
            Severity: Minor
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 50 mins to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1561..1564

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

            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

            Similar blocks of code found in 3 locations. Consider refactoring.
            Open

            def CheckGuidRegFormat(GuidValue):
                ## Regular expression used to find out register format of GUID
                #
                RegFormatGuidPattern = re.compile("^\s*([0-9a-fA-F]){8}-"
                                                   "([0-9a-fA-F]){4}-"
            Severity: Major
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 2 other locations - About 40 mins to fix
            BaseTools/Source/Python/UPT/Parser/InfParserMisc.py on lines 159..164
            BaseTools/Source/Python/UPT/Parser/InfParserMisc.py on lines 175..180

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

            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

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

                        if self.SubDir:
                            self.Dir = os.path.join(RealRoot, self.SubDir)
                        else:
                            self.Dir = RealRoot
            Severity: Minor
            Found in BaseTools/Source/Python/UPT/Library/Misc.py and 1 other location - About 30 mins to fix
            BaseTools/Source/Python/Common/Misc.py on lines 1593..1596

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

            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