hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/UPT/InstallPkg.py

Summary

Maintainability
F
1 wk
Test Coverage

File InstallPkg.py has 496 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# Install distribution package.
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
Severity: Minor
Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 7 hrs to fix

    Function InstallModuleContent has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

    def InstallModuleContent(FromPath, NewPath, ModulePath, Module, ContentZipFile,
        WorkspaceDir, ModuleList, Package = None, ReadOnly = False):
        
        if NewPath.startswith("\\") or NewPath.startswith("/"):
            NewPath = NewPath[1:]
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 7 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function InstallPackageContent has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    def InstallPackageContent(FromPath, ToPath, Package, ContentZipFile, Dep,
        WorkspaceDir, ModuleList, ReadOnly = False):
        if Dep:
            pass
        Package.FileList = []
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/InstallPkg.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 InstallModuleContentZipFile has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    def InstallModuleContentZipFile(ContentZipFile, FromPath, ModulePath, WorkspaceDir, NewPath, Module, Package, ReadOnly,
                                    ModuleList):
        #
        # Extract other files under current module path in content Zip file but not listed in the description 
        #
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/InstallPkg.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 GetModuleList has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetModuleList(DistPkg, Dep, WorkspaceDir, ContentZipFile, ModuleList):
        #
        # ModulePathList will keep track of the standalone module path that
        # we just installed. If a new module's path in that list 
        # (only multiple INF in one directory will be so), we will 
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/InstallPkg.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 Main has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def Main(Options = None):
        ContentZipFile, DistFile = None, None
    
        try:
            DataBase = GlobalData.gDB        
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/InstallPkg.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 GetDPFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

    def GetDPFile(ZipFile):
        ContentFile = ''
        DescFile = ''
        for FileName in ZipFile.namelist():
            if FileName.endswith('.content'):
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/InstallPkg.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 InstallModuleContent has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def InstallModuleContent(FromPath, NewPath, ModulePath, Module, ContentZipFile,
    Severity: Major
    Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 1 hr to fix

      Function InstallModuleContentZipFile has 9 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def InstallModuleContentZipFile(ContentZipFile, FromPath, ModulePath, WorkspaceDir, NewPath, Module, Package, ReadOnly,
      Severity: Major
      Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 1 hr to fix

        Function UnZipDp has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        def UnZipDp(WorkspaceDir, Options, DataBase):
            ContentZipFile = None
            Logger.Quiet(ST.MSG_UZIP_PARSE_XML)
            DpPkgFileName = Options.PackageFile
            DistFile = PackageFile(DpPkgFileName)
        Severity: Minor
        Found in BaseTools/Source/Python/UPT/InstallPkg.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 InstallPackageContent has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def InstallPackageContent(FromPath, ToPath, Package, ContentZipFile, Dep,
        Severity: Major
        Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 1 hr to fix

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

          def GenToolMisc(DistPkg, WorkspaceDir, ContentZipFile):
              ToolObject = DistPkg.Tools
              MiscObject = DistPkg.MiscellaneousFiles
              DistPkg.FileList = []
              FileList = []
          Severity: Minor
          Found in BaseTools/Source/Python/UPT/InstallPkg.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 GetPackageList has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def GetPackageList(DistPkg, Dep, WorkspaceDir, Options, ContentZipFile, ModuleList, PackageList):
          Severity: Major
          Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 50 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if Package and ((ToFile, Md5Sum) not in Package.FileList):
                                    Package.FileList.append((ToFile, Md5Sum))
                                elif Package:
                                    continue
                                elif (ToFile, Md5Sum) not in Module.FileList:
            Severity: Major
            Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if Item[0] == ToFile:
                                      break
                              else:
              Severity: Major
              Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 45 mins to fix

                Function InstallNewPackage has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                def InstallNewPackage(WorkspaceDir, Path, CustomPath = False):
                    if os.path.isabs(Path):
                        Logger.Info(ST.MSG_RELATIVE_PATH_ONLY%Path)
                    elif CustomPath:
                        Logger.Info(ST.MSG_NEW_PKG_PATH)
                Severity: Minor
                Found in BaseTools/Source/Python/UPT/InstallPkg.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

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

                def InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly, Executable=False):
                Severity: Minor
                Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 35 mins to fix

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

                  def GetModuleList(DistPkg, Dep, WorkspaceDir, ContentZipFile, ModuleList):
                  Severity: Minor
                  Found in BaseTools/Source/Python/UPT/InstallPkg.py - About 35 mins to fix

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

                    def InstallNewModule(WorkspaceDir, Path, PathList = None):
                        if PathList == None:
                            PathList = []
                        Path = ConvertPath(Path)
                        Path = os.path.normpath(Path)
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/InstallPkg.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 InstallFile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def InstallFile(ContentZipFile, FromFile, ToFile, ReadOnly, Executable=False):
                        if not ContentZipFile or not ContentZipFile.UnpackFile(FromFile, ToFile):
                            Logger.Error("UPT", FILE_NOT_FOUND, ST.ERR_INSTALL_FILE_FROM_EMPTY_CONTENT%FromFile)
                    
                        if ReadOnly:
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/InstallPkg.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 FileUnderPath has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def FileUnderPath(FileName, CheckPath):
                        FileName = FileName.replace('\\', '/')
                        FileName = os.path.normpath(FileName)
                        CheckPath = CheckPath.replace('\\', '/')
                        CheckPath = os.path.normpath(CheckPath)
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/InstallPkg.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 GetPackageList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def GetPackageList(DistPkg, Dep, WorkspaceDir, Options, ContentZipFile, ModuleList, PackageList):
                        NewDict = Sdict()
                        for Guid, Version, Path in DistPkg.PackageSurfaceArea:
                            PackagePath = Path
                            Package = DistPkg.PackageSurfaceArea[Guid, Version, Path]
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/InstallPkg.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 Item in Module.GetSourceFileList():
                            File = Item.GetSourceFile()
                            if File.startswith("\\") or File.startswith("/"):
                                File = File[1:]
                                
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 1 other location - About 1 day to fix
                    BaseTools/Source/Python/UPT/InstallPkg.py on lines 534..550

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

                    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

                            for FileName in FileNameList:              
                                File = FileName.GetFilename()          
                                if File.startswith("\\") or File.startswith("/"):
                                    File = File[1:]
                                    
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 1 other location - About 1 day to fix
                    BaseTools/Source/Python/UPT/InstallPkg.py on lines 515..531

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

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

                        except FatalError, XExcept:
                            ReturnCode = XExcept.args[0]
                            if Logger.GetLevel() <= Logger.DEBUG_9:
                                Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
                                    platform) + format_exc())
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 3 other locations - About 3 hrs to fix
                    BaseTools/Source/Python/UPT/MkPkg.py on lines 217..221
                    BaseTools/Source/Python/UPT/RmPkg.py on lines 223..227
                    BaseTools/Source/Python/UPT/UPT.py on lines 161..226

                    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

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

                        except KeyboardInterrupt:
                            ReturnCode = ABORT_ERROR
                            if Logger.GetLevel() <= Logger.DEBUG_9:
                                Logger.Quiet(ST.MSG_PYTHON_ON % (python_version(),
                                    platform) + format_exc())
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 2 other locations - About 2 hrs to fix
                    BaseTools/Source/Python/UPT/MkPkg.py on lines 222..226
                    BaseTools/Source/Python/UPT/RmPkg.py on lines 228..232

                    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

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

                        Module.SetFullPath(os.path.normpath(os.path.join(NewModuleFullPath,
                            ConvertPath(Module.GetName()) + '.inf')))
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 1 other location - About 1 hr to fix
                    BaseTools/Source/Python/UPT/InstallPkg.py on lines 732..733

                    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

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

                        Package.SetFullPath(os.path.normpath(os.path.join(PackageFullPath,
                            ConvertPath(Package.GetName()) + '.dec')))
                    Severity: Major
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 1 other location - About 1 hr to fix
                    BaseTools/Source/Python/UPT/InstallPkg.py on lines 490..491

                    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

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

                            NewDpPkgFileName = DestFile[DestFile.find(DestDir) + len(DestDir) + 1:]
                    Severity: Minor
                    Found in BaseTools/Source/Python/UPT/InstallPkg.py and 2 other locations - About 35 mins to fix
                    BaseTools/Source/Python/UPT/Core/DependencyRules.py on lines 232..232
                    BaseTools/Source/Python/UPT/Core/DependencyRules.py on lines 233..234

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

                    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