hackedteam/vector-edk

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

Summary

Maintainability
F
2 wks
Test Coverage

File String.py has 404 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# This file is used to define common string related functions used in parsing process
#
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
Severity: Minor
Found in BaseTools/Source/Python/Common/String.py - About 5 hrs to fix

    Function GetSingleValueOfKeyFromLines has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
        Lines = Lines.split('\n')
        Keys = []
        Value = ''
        DefineValues = ['']
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.py - About 5 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 CleanString has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
    Open

    def CleanString(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False, BuildOption=False):
        #
        # remove whitespace
        #
        Line = Line.strip();
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 GetSplitValueList has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetSplitValueList(String, SplitTag=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
        ValueList = []
        Last = 0
        Escaped = False
        InString = False
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 StringToArray has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def StringToArray(String):
        if isinstance(String, unicode):
            if len(unicode) == 0:
                return "{0x00, 0x00}"
            return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String])
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 ReplaceMacro has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def ReplaceMacro(String, MacroDefinitions={}, SelfReplacement=False, RaiseError=False):
        LastString = String
        while String and MacroDefinitions:
            MacroUsed = GlobalData.gMacroRefPattern.findall(String)
            # no macro found in String, stop replacing
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 PreCheck has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def PreCheck(FileName, FileContent, SupSectionTag):
        LineNo = 0
        IsFailed = False
        NewFileContent = ''
        for Line in FileContent.splitlines():
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 RemoveDupOption has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def RemoveDupOption(OptionString, Which="/I", Against=None):
        OptionList = OptionString.split()
        ValueList = []
        if Against:
            ValueList += Against
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 GetLineNo has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetLineNo(FileContent, Line, IsIgnoreComment=True):
        LineList = FileContent.splitlines()
        for Index in range(len(LineList)):
            if LineList[Index].find(Line) > -1:
                #
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.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 CheckFileExist has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
    Severity: Minor
    Found in BaseTools/Source/Python/Common/String.py - About 45 mins to fix

      Function GetSingleValueOfKeyFromLines has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def GetSingleValueOfKeyFromLines(Lines, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):
      Severity: Minor
      Found in BaseTools/Source/Python/Common/String.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if Key[0] not in Keys:
                                Dictionary[Key[0]] = Value
                                Keys.append(Key[0])
                            else:
                                Dictionary[Key[0]].extend(Value)
        Severity: Major
        Found in BaseTools/Source/Python/Common/String.py - About 45 mins to fix

          Function CheckFileType has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
          Severity: Minor
          Found in BaseTools/Source/Python/Common/String.py - About 45 mins to fix

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

            def RaiseParserError(Line, Section, File, Format='', LineNo= -1):
            Severity: Minor
            Found in BaseTools/Source/Python/Common/String.py - About 35 mins to fix

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

              def RemoveBlockComment(Lines):
                  IsFindBlockComment = False
                  IsFindBlockCode = False
                  ReservedLine = ''
                  NewLines = []
              Severity: Minor
              Found in BaseTools/Source/Python/Common/String.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 CleanString2 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              def CleanString2(Line, CommentCharacter=DataType.TAB_COMMENT_SPLIT, AllowCppStyleComment=False):
                  #
                  # remove whitespace
                  #
                  Line = Line.strip();
              Severity: Minor
              Found in BaseTools/Source/Python/Common/String.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 "{0x00,0x00}"
              Severity: Major
              Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                return "{%s, 0x00,0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])
                Severity: Major
                Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return "{%s, 0x00}" % ", ".join([ C for C in String[1:-1].split(',')])
                  Severity: Major
                  Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                return '{%s, 0}' % ', '.join(String.split())
                    Severity: Major
                    Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return '{%s, 0,0}' % ', '.join(String.split())
                      Severity: Major
                      Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return "{%s, 0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])
                        Severity: Major
                        Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                      return "{%s}" % ", ".join([ C for C in String[1:-1].split(',')])
                          Severity: Major
                          Found in BaseTools/Source/Python/Common/String.py - About 30 mins to fix

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

                            def GetHelpTextList(HelpTextClassList):
                                List = []
                                if HelpTextClassList:
                                    for HelpText in HelpTextClassList:
                                        if HelpText.String.endswith('\n'):
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.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 CheckFileExist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def CheckFileExist(WorkspaceDir, CheckFilename, ContainerFilename, SectionName, Line, LineNo= -1):
                                CheckFile = ''
                                if CheckFilename != '' and CheckFilename != None:
                                    CheckFile = WorkspaceFile(WorkspaceDir, CheckFilename)
                                    if not os.path.isfile(CheckFile):
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.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 CheckFileType has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def CheckFileType(CheckFilename, ExtName, ContainerFilename, SectionName, Line, LineNo= -1):
                                if CheckFilename != '' and CheckFilename != None:
                                    (Root, Ext) = os.path.splitext(CheckFilename)
                                    if Ext.upper() != ExtName.upper():
                                        ContainerFile = open(ContainerFilename, 'r').read()
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.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 NormPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def NormPath(Path, Defines={}):
                                IsRelativePath = False
                                if Path:
                                    if Path[0] == '.':
                                        IsRelativePath = True
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.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

                                for Line in FileContent.splitlines():
                                    LineNo = LineNo + 1
                                    #
                                    # Clean current line
                                    #
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 2 days to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 476..505

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

                            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 RemoveDupOption(OptionString, Which="/I", Against=None):
                                OptionList = OptionString.split()
                                ValueList = []
                                if Against:
                                    ValueList += Against
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 1 day to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 700..717

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

                            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 SplitModuleType(Key):
                                KeyList = Key.split(DataType.TAB_SPLIT)
                                #
                                # Fill in for arch
                                #
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 1 day to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 137..154

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

                            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 StringArrayLength(String):
                                if isinstance(String, unicode):
                                    return (len(String) + 1) * 2 + 1;
                                elif String.startswith('L"'):
                                    return (len(String) - 3 + 1) * 2
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 1 day to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 682..690

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

                            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 GenDefines(String, Arch, Defines):
                                if String.find(DataType.TAB_DEFINE + ' ') > -1:
                                    List = String.replace(DataType.TAB_DEFINE + ' ', '').split(DataType.TAB_EQUAL_SPLIT)
                                    if len(List) == 2:
                                        Defines[(CleanString(List[0]), Arch)] = CleanString(List[1])
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 7 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 74..83

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

                            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 Key[0] in Dictionary:
                                                if Key[0] not in Keys:
                                                    Dictionary[Key[0]] = Value
                                                    Keys.append(Key[0])
                                                else:
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 7 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 442..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 118.

                            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 4 locations. Consider refactoring.
                            Open

                            def GetLibraryClassesWithModuleType(Lines, Key, KeyValues, CommentCharacter):
                                newKey = SplitModuleType(Key)
                                Lines = Lines.split(DataType.TAB_SECTION_END, 1)[1]
                                LineList = Lines.splitlines()
                                for Line in LineList:
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 3 other locations - About 7 hrs to fix
                            BaseTools/Source/Python/Common/String.py on lines 184..197
                            BaseTools/Source/Python/UPT/Library/String.py on lines 94..103
                            BaseTools/Source/Python/UPT/Library/String.py on lines 114..127

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

                            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 4 locations. Consider refactoring.
                            Open

                            def GetDynamics(Lines, Key, KeyValues, CommentCharacter):
                                #
                                # Get SkuId Name List
                                #
                                SkuIdNameList = SplitModuleType(Key)
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 3 other locations - About 7 hrs to fix
                            BaseTools/Source/Python/Common/String.py on lines 162..171
                            BaseTools/Source/Python/UPT/Library/String.py on lines 94..103
                            BaseTools/Source/Python/UPT/Library/String.py on lines 114..127

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

                            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 GlobalData.gIsWindows:
                                            if ChIndex == 0 or Line[ChIndex - 1] != '^':
                                                Line = Line[0:ChIndex] + '^' + Line[ChIndex:]
                                                ChIndex = Line.find('#', ChIndex + 2)
                                            else:
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 6 hrs to fix
                            BaseTools/Source/Python/Common/String.py on lines 350..361

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

                            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 GetLineNo(FileContent, Line, IsIgnoreComment=True):
                                LineList = FileContent.splitlines()
                                for Index in range(len(LineList)):
                                    if LineList[Index].find(Line) > -1:
                                        #
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 6 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 573..585

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

                            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 GetHelpTextList(HelpTextClassList):
                                List = []
                                if HelpTextClassList:
                                    for HelpText in HelpTextClassList:
                                        if HelpText.String.endswith('\n'):
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 5 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 667..674

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

                            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 GetStringOfList(List, Split=' '):
                                if type(List) != type([]):
                                    return List
                                Str = ''
                                for Item in List:
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 3 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 653..659

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

                            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 4 locations. Consider refactoring.
                            Open

                                    if Line.find(DataType.TAB_INF_DEFINES_SPEC + ' ') > -1:
                                        if '' in SpecValues:
                                            SpecValues.remove('')
                                        SpecValues.append(GetDefineValue(Line, DataType.TAB_INF_DEFINES_SPEC, CommentCharacter))
                                        continue
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 3 other locations - About 2 hrs to fix
                            BaseTools/Source/Python/Common/String.py on lines 499..503
                            BaseTools/Source/Python/UPT/Library/String.py on lines 415..419
                            BaseTools/Source/Python/UPT/Library/String.py on lines 420..424

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

                            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 4 locations. Consider refactoring.
                            Open

                                    if Line.find(DataType.TAB_INF_DEFINES_DEFINE + ' ') > -1:
                                        if '' in DefineValues:
                                            DefineValues.remove('')
                                        DefineValues.append(GetDefineValue(Line, DataType.TAB_INF_DEFINES_DEFINE, CommentCharacter))
                                        continue
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 3 other locations - About 2 hrs to fix
                            BaseTools/Source/Python/Common/String.py on lines 504..508
                            BaseTools/Source/Python/UPT/Library/String.py on lines 415..419
                            BaseTools/Source/Python/UPT/Library/String.py on lines 420..424

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

                            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

                                    elif Line[Index] == CommentCharacter and InString:
                                        CommentInString = True
                                    elif Line[Index] == CommentCharacter and not InString:
                                        Comment = Line[Index:].strip()
                                        Line = Line[0:Index].strip()
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 2 hrs to fix
                            BaseTools/Source/Python/UPT/Parser/DecParserMisc.py on lines 129..132

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

                            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

                                    IncludeFile = CleanString(String[String.upper().find(DataType.TAB_INCLUDE.upper() + ' ') + len(DataType.TAB_INCLUDE + ' ') : ])
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 2 hrs to fix
                            BaseTools/Source/Python/Common/DscClassObject.py on lines 922..922

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

                            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 MergeArches(Dict, Key, Arch):
                                if Key in Dict.keys():
                                    Dict[Key].append(Arch)
                                else:
                                    Dict[Key] = Arch.split()
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 2 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 58..62

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

                            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

                                for Line in LineList:
                                    Line = CleanString(Line, CommentCharacter)
                                    if Line != '' and Line[0] != CommentCharacter:
                                        KeyValues += [Line]
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 2 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 364..367

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

                            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 Path:
                                    if Path[0] == '.':
                                        IsRelativePath = True
                                    #
                                    # Replace with Define
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 2 hrs to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 249..260

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

                            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 StringLen % 2:
                                            return "{%s, 0x00}" % ", ".join(["0x%02x" % ord(C) for C in String[1:-1]])
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 2 other locations - About 1 hr to fix
                            BaseTools/Source/Python/Common/String.py on lines 798..801
                            BaseTools/Source/Python/Common/String.py on lines 807..810

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

                            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 String == "L\"\"":
                                        return "{0x00, 0x00}"
                                    else:
                                        return "{%s, 0x00, 0x00}" % ", ".join(["0x%02x, 0x00" % ord(C) for C in String[2:-1]])
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 2 other locations - About 1 hr to fix
                            BaseTools/Source/Python/Common/String.py on lines 807..808
                            BaseTools/Source/Python/Common/String.py on lines 807..810

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

                            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

                                    elif Line[Index] == CommentCharacter and InString :
                                        CommentInString = True
                                    elif Line[Index] == CommentCharacter and not InString :
                                        Line = Line[0: Index]
                                        break
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 1 hr to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 290..294

                            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 2 locations. Consider refactoring.
                            Open

                            def GetSplitList(String, SplitStr=DataType.TAB_VALUE_SPLIT, MaxSplit= -1):
                                return map(lambda l: l.strip(), String.split(SplitStr, MaxSplit))
                            Severity: Major
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 1 hr to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 46..47

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

                            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 LineNo == -1:
                                    LineNo = GetLineNo(open(os.path.normpath(File), 'r').read(), Line)
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 55 mins to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 597..598

                            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

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

                                return String[String.find(Key + ' ') + len(Key + ' ') : ]
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 55 mins to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 383..383

                            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 2 locations. Consider refactoring.
                            Open

                                    if StringLen % 2:
                                        return "{%s, 0x00}" % ", ".join([ C for C in String[1:-1].split(',')])
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 55 mins to fix
                            BaseTools/Source/Python/Common/String.py on lines 813..816

                            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

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

                                if IsRelativePath and Path[0] != '.':
                                    Path = os.path.join('.', Path)
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 45 mins to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 262..263

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

                            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 len(Key) == 1 and Key[0][0] != CommentCharacter:
                            Severity: Minor
                            Found in BaseTools/Source/Python/Common/String.py and 1 other location - About 40 mins to fix
                            BaseTools/Source/Python/UPT/Library/String.py on lines 432..432

                            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

                            There are no issues that match your filters.

                            Category
                            Status