hackedteam/vector-edk

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

Summary

Maintainability
F
6 days
Test Coverage

Function BuildMetaDataFileDatabase has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def BuildMetaDataFileDatabase(self):
        EdkLogger.quiet("Building database for meta data files ...")
        Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
        #SkipDirs = Read from config file
        SkipDirs = EccGlobalData.gConfig.SkipDirList
Severity: Minor
Found in BaseTools/Source/Python/Ecc/Ecc.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 ParseOption has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    def ParseOption(self):
        EdkLogger.quiet("Loading ECC configuration ... done")
        (Options, Target) = self.EccOptionParser()

        if Options.Workspace:
Severity: Minor
Found in BaseTools/Source/Python/Ecc/Ecc.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 GetRealPathCase has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def GetRealPathCase(self, path):
        TmpPath = path.rstrip(os.sep)
        PathParts = TmpPath.split(os.sep)
        if len(PathParts) == 0:
            return path
Severity: Minor
Found in BaseTools/Source/Python/Ecc/Ecc.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

File Ecc.py has 260 lines of code (exceeds 250 allowed). Consider refactoring.
Open

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

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

        def __init__(self):
            # Version and Copyright
            self.VersionNumber = ("0.01" + " " + gBUILD_VERSION)
            self.Version = "%prog Version " + self.VersionNumber
            self.Copyright = "Copyright (c) 2009 - 2010, Intel Corporation  All rights reserved."
    Severity: Minor
    Found in BaseTools/Source/Python/Ecc/Ecc.py - About 1 hr 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/Ecc/Ecc.py and 1 other location - About 1 day to fix
      BaseTools/Source/Python/Eot/Eot.py on lines 637..648

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 142.

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

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

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

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

      Refactorings

      Further Reading

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

                      if len(File) > 4 and File[-4:].upper() == ".DEC":
                          Filename = os.path.normpath(os.path.join(Root, File))
                          EdkLogger.quiet("Parsing %s" % Filename)
                          Op.write("%s\r" % Filename)
                          #Dec(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
      Severity: Major
      Found in BaseTools/Source/Python/Ecc/Ecc.py and 1 other location - About 7 hrs to fix
      BaseTools/Source/Python/Ecc/Ecc.py on lines 201..208

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

      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 len(File) > 4 and File[-4:].upper() == ".INF":
                          Filename = os.path.normpath(os.path.join(Root, File))
                          EdkLogger.quiet("Parsing %s" % Filename)
                          Op.write("%s\r" % Filename)
                          #Inf(Filename, True, True, EccGlobalData.gWorkspace, EccGlobalData.gDb)
      Severity: Major
      Found in BaseTools/Source/Python/Ecc/Ecc.py and 1 other location - About 7 hrs to fix
      BaseTools/Source/Python/Ecc/Ecc.py on lines 182..189

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

      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/Ecc/Ecc.py and 1 other location - About 5 hrs to fix
      BaseTools/Source/Python/Eot/Eot.py on lines 580..588

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

                  for Dir in Dirs:
                      Dirname = os.path.join(Root, Dir)
                      if os.path.islink(Dirname):
                          Dirname = os.path.realpath(Dirname)
                          if os.path.isdir(Dirname):
      Severity: Major
      Found in BaseTools/Source/Python/Ecc/Ecc.py and 2 other locations - About 4 hrs to fix
      BaseTools/Source/Python/Ecc/Check.py on lines 78..85
      BaseTools/Source/Python/Ecc/c.py on lines 507..514

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

      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 "ECP_SOURCE" not in os.environ:
                  os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
      Severity: Minor
      Found in BaseTools/Source/Python/Ecc/Ecc.py and 1 other location - About 50 mins to fix
      BaseTools/Source/Python/build/build.py on lines 109..110

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 36.

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

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

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

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

      Refactorings

      Further Reading

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

              if "EFI_SOURCE" not in os.environ:
                  os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]
      Severity: Major
      Found in BaseTools/Source/Python/Ecc/Ecc.py and 3 other locations - About 35 mins to fix
      BaseTools/Source/Python/Ecc/Ecc.py on lines 75..76
      BaseTools/Source/Python/build/build.py on lines 111..112
      BaseTools/Source/Python/build/build.py on lines 113..114

      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

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

              if "EDK_SOURCE" not in os.environ:
                  os.environ["EDK_SOURCE"] = os.environ["ECP_SOURCE"]
      Severity: Major
      Found in BaseTools/Source/Python/Ecc/Ecc.py and 3 other locations - About 35 mins to fix
      BaseTools/Source/Python/Ecc/Ecc.py on lines 73..74
      BaseTools/Source/Python/build/build.py on lines 111..112
      BaseTools/Source/Python/build/build.py on lines 113..114

      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