hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/AutoGen/BuildEngine.py

Summary

Maintainability
F
3 days
Test Coverage

File BuildEngine.py has 412 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# The engine for building files
#
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials
Severity: Minor
Found in BaseTools/Source/Python/AutoGen/BuildEngine.py - About 5 hrs to fix

    Function ParseSectionHeader has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def ParseSectionHeader(self, LineIndex):
            self._RuleInfo = tdict(True, 2)
            self._BuildTypeList = []
            self._ArchList = []
            self._FamilyList = []
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.py - About 4 hrs to fix

    Cognitive Complexity

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

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

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

    Further reading

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

        def __init__(self, Type, Input, Output, Command, ExtraDependency=None):
            # The Input should not be empty
            if not Input:
                Input = []
            if not Output:
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.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 Parse has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def Parse(self):
            self._State = self._Section
            for Index in range(self._LineIndex, len(self.RuleContent)):
                # Clean up the line and replace path separator with native one
                Line = self.RuleContent[Index].strip().replace(self._PATH_SEP, os.path.sep)
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.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 Apply has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def Apply(self, SourceFile):
            if not self.CommandList or not self.DestFileList:
                return None
    
            # source file
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.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 EndOfSection has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def EndOfSection(self):
            Database = self.RuleDatabase
            # if there's specific toochain family, 'COMMON' doesn't make sense any more
            if len(self._TotalToolChainFamilySet) > 1 and 'COMMON' in self._TotalToolChainFamilySet:
                self._TotalToolChainFamilySet.remove('COMMON')
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.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 ParseSubSectionHeader has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def ParseSubSectionHeader(self, LineIndex):
            SectionType = ""
            List = self.RuleContent[LineIndex][1:-1].split(',')
            FamilyList = []
            for Section in List:
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.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 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, Type, Input, Output, Command, ExtraDependency=None):
    Severity: Minor
    Found in BaseTools/Source/Python/AutoGen/BuildEngine.py - About 35 mins to fix

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

          def __getitem__(self, Key):
              if not Key:
                  return None
      
              if Key[0] in self.Ext2FileType:
      Severity: Minor
      Found in BaseTools/Source/Python/AutoGen/BuildEngine.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

              if 'COMMON' in self._BuildTypeList and len(self._BuildTypeList) > 1:
                  EdkLogger.error("build", FORMAT_INVALID,
                                  "Specific build types must not be mixed with common one",
                                  File=self.RuleFile, Line=LineIndex+1,
                                  ExtraData=self.RuleContent[LineIndex])
      Severity: Major
      Found in BaseTools/Source/Python/AutoGen/BuildEngine.py and 1 other location - About 3 hrs to fix
      BaseTools/Source/Python/AutoGen/BuildEngine.py on lines 491..495

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

      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 'COMMON' in self._ArchList and len(self._ArchList) > 1:
                  EdkLogger.error("build", FORMAT_INVALID,
                                  "Specific ARCH must not be mixed with common one",
                                  File=self.RuleFile, Line=LineIndex+1,
                                  ExtraData=self.RuleContent[LineIndex])
      Severity: Major
      Found in BaseTools/Source/Python/AutoGen/BuildEngine.py and 1 other location - About 3 hrs to fix
      BaseTools/Source/Python/AutoGen/BuildEngine.py on lines 486..490

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

      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 InputFiles == None:
                      InputFiles = []
                      self._RuleInfo[ToolChainFamily, self._State] = InputFiles
      Severity: Minor
      Found in BaseTools/Source/Python/AutoGen/BuildEngine.py and 1 other location - About 35 mins to fix
      BaseTools/Source/Python/AutoGen/BuildEngine.py on lines 560..562

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

                  if Items == None:
                      Items = []
                      self._RuleInfo[ToolChainFamily, self._State] = Items
      Severity: Minor
      Found in BaseTools/Source/Python/AutoGen/BuildEngine.py and 1 other location - About 35 mins to fix
      BaseTools/Source/Python/AutoGen/BuildEngine.py on lines 548..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 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