hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/Eot/Eot.py

Summary

Maintainability
F
6 days
Test Coverage

Function GenerateSourceFileList has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

    def GenerateSourceFileList(self, SourceFileList, IncludeFileList):
        EdkLogger.quiet("Generating source files list ... ")
        mSourceFileList = []
        mInfFileList = []
        mDecFileList = []
Severity: Minor
Found in BaseTools/Source/Python/Eot/Eot.py - About 6 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

File Eot.py has 383 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# This file is used to be the main entrance of EOT tool
#
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
Severity: Minor
Found in BaseTools/Source/Python/Eot/Eot.py - About 5 hrs to fix

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

        def __init__(self, CommandLineOption=True, IsInit=True, SourceFileList=None, \
                     IncludeDirList=None, DecFileList=None, GuidList=None, LogFile=None,
                     FvFileList="", MapFileList="", Report='Report.html', Dispatch=None):
            # Version and Copyright
            self.VersionNumber = ("0.02" + " " + gBUILD_VERSION)
    Severity: Minor
    Found in BaseTools/Source/Python/Eot/Eot.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 GenerateReportDatabase has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def GenerateReportDatabase(self):
            EdkLogger.quiet("Generating the cross-reference table of GUID for Ppi/Protocol ... ")
    
            # Update Protocol/Ppi Guid
            SqlCommand = """select DISTINCT GuidName from Report"""
    Severity: Minor
    Found in BaseTools/Source/Python/Eot/Eot.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 ParseDecFile has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def ParseDecFile(self, DecFileList):
            if DecFileList:
                path = os.path.normpath(DecFileList)
                lfr = open(path, 'rb')
                for line in lfr:
    Severity: Minor
    Found in BaseTools/Source/Python/Eot/Eot.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 ConvertLogFile has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

        def ConvertLogFile(self, LogFile):
            newline = []
            lfr = None
            lfw = None
            if LogFile:
    Severity: Minor
    Found in BaseTools/Source/Python/Eot/Eot.py - About 1 hr to fix

    Cognitive Complexity

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

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

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

    Further reading

    Function __init__ has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def __init__(self, CommandLineOption=True, IsInit=True, SourceFileList=None, \
                     IncludeDirList=None, DecFileList=None, GuidList=None, LogFile=None,
                     FvFileList="", MapFileList="", Report='Report.html', Dispatch=None):
            # Version and Copyright
            self.VersionNumber = ("0.02" + " " + gBUILD_VERSION)
    Severity: Minor
    Found in BaseTools/Source/Python/Eot/Eot.py - About 1 hr to fix

      Function __init__ has 11 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self, CommandLineOption=True, IsInit=True, SourceFileList=None, \
      Severity: Major
      Found in BaseTools/Source/Python/Eot/Eot.py - About 1 hr to fix

        Avoid deeply nested control flow statements.
        Open

                                if FullPath not in mDecFileList and File.upper().find('.DEC') > -1:
                                    mDecFileList.append(FullPath)
        
        Severity: Major
        Found in BaseTools/Source/Python/Eot/Eot.py - About 45 mins to fix

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

              def ParseOption(self):
                  (Options, Target) = self.EotOptionParser()
          
                  # Set log level
                  self.SetLogLevel(Options)
          Severity: Minor
          Found in BaseTools/Source/Python/Eot/Eot.py - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Avoid deeply nested control flow statements.
          Open

                                  if FullPath not in mSourceFileList and File[-2:].upper() == '.H':
                                      mSourceFileList.append(FullPath)
                                      EotGlobalData.gOP_SOURCE_FILES.write('%s\n' % FullPath)
                                  if FullPath not in mDecFileList and File.upper().find('.DEC') > -1:
          Severity: Major
          Found in BaseTools/Source/Python/Eot/Eot.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if len(list) == 2:
                                        EotGlobalData.gGuidDict[list[0].strip()] = GuidStructureStringToGuidString(list[1].strip())
            
                
                ## ParseGuidList() method
            Severity: Major
            Found in BaseTools/Source/Python/Eot/Eot.py - About 45 mins to fix

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

              if __name__ == '__main__':
                  # Initialize log system
                  EdkLogger.Initialize()
                  EdkLogger.IsRaiseError = False
                  EdkLogger.quiet(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 1 day to fix
              BaseTools/Source/Python/Ecc/Ecc.py on lines 384..395

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 142.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                  def SetLogLevel(self, Option):
                      if Option.verbose != None:
                          EdkLogger.SetLevel(EdkLogger.VERBOSE)
                      elif Option.quiet != None:
                          EdkLogger.SetLevel(EdkLogger.QUIET)
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 5 hrs to fix
              BaseTools/Source/Python/Ecc/Ecc.py on lines 331..339

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

              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 self.MapFileList:
                          for MapFile in GetSplitValueList(self.MapFileList, ' '):
                              MapFile = os.path.normpath(MapFile)
                              if not os.path.isfile(MapFile):
                                  EdkLogger.error("Eot", EdkLogger.EOT_ERROR, "Can not find file %s " % MapFile)
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 3 hrs to fix
              BaseTools/Source/Python/Eot/Eot.py on lines 88..93

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

              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 self.FvFileList:
                          for FvFile in GetSplitValueList(self.FvFileList, ' '):
                              FvFile = os.path.normpath(FvFile)
                              if not os.path.isfile(FvFile):
                                  EdkLogger.error("Eot", EdkLogger.EOT_ERROR, "Can not find file %s " % FvFile)
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 3 hrs to fix
              BaseTools/Source/Python/Eot/Eot.py on lines 97..102

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

              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 self.IsInit:
                          self.BuildMetaDataFileDatabase(EotGlobalData.gINF_FILES)
                          EdkLogger.quiet("Building database for source code ...")
                          c.CreateCCodeDB(EotGlobalData.gSOURCE_FILES)
                          EdkLogger.quiet("Building database for source code done!")
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 1 hr to fix
              AppPkg/Applications/Python/Python-2.7.2/Demo/parser/unparse.py on lines 501..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 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 2 locations. Consider refactoring.
              Open

                          if Record[1] == 'Ppi':
                              EotGlobalData.gPpiList[Record[0].lower()] = -2
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 1 hr to fix
              BaseTools/Source/Python/Eot/Eot.py on lines 384..385

              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

                          if Record[1] == 'Protocol':
                              EotGlobalData.gProtocolList[Record[0].lower()] = -2
              Severity: Major
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 1 hr to fix
              BaseTools/Source/Python/Eot/Eot.py on lines 382..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 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

                              GuidValue = GuidValue.lower().replace('\\', '').replace('\r', '').replace('\n', '').replace('l', '').strip()
              Severity: Minor
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 45 mins to fix
              BaseTools/Source/Python/Ecc/Check.py on lines 824..824

              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

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

                              if index > -1:
                                  newline.append(line[index + 57 : ])
                                  continue
              Severity: Minor
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 30 mins to fix
              BaseTools/Source/Python/Eot/Eot.py on lines 204..206

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

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

                              if index > -1:
                                  newline.append(line[index + 55 : ])
                                  continue
              Severity: Minor
              Found in BaseTools/Source/Python/Eot/Eot.py and 1 other location - About 30 mins to fix
              BaseTools/Source/Python/Eot/Eot.py on lines 208..210

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              There are no issues that match your filters.

              Category
              Status