hackedteam/vector-edk

View on GitHub
BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py

Summary

Maintainability
F
5 days
Test Coverage

File DecParserUnitTest.py has 348 lines of code (exceeds 250 allowed). Consider refactoring.
Open

## @file
# This file contain unit test for DecParser
#
# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
#
Severity: Minor
Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py - About 4 hrs to fix

    Function testParse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def testParse(self):
            Content = \
            '''# Top comment
            [TOP]
              # sub1 head comment
    Severity: Minor
    Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py - About 1 hr to fix

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

          def testDecHeadComment(self):
              File = TmpFile('test.dec')
              File.Write(
             '''# abc
                ##''')
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 1 other location - About 1 day to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 515..528

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

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

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

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

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

      Refactorings

      Further Reading

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

          def testNoDoubleComment(self):
              File = TmpFile('test.dec')
              File.Write(
             '''# abc
                #
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 1 other location - About 1 day to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 501..513

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

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

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

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

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

      Refactorings

      Further Reading

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

          def GetObj(self, Content):
              Obj = _DecGuid(FileContent('dummy', Content.splitlines()))
              Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
              Obj._RawData.CurrentScope = [('guids'.upper(), 'COMMON')]
              return Obj
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 1 other location - About 2 hrs to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 290..294

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 61.

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

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

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

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

      Refactorings

      Further Reading

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

          def GetObj(self, Content):
              Obj = _DecPcd(FileContent('dummy', Content.splitlines()))
              Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
              Obj._RawData.CurrentScope = [('PcdsFeatureFlag'.upper(), 'COMMON')]
              return Obj
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 1 other location - About 2 hrs to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 340..344

      Duplicated Code

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

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

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

      Tuning

      This issue has a mass of 61.

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

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

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

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

      Refactorings

      Further Reading

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

          def testDecDefine(self):
              item = self.GetObj('PACKAGE_NAME = MdePkg')._ParseItem()
              self.assertEqual(item.Key, 'PACKAGE_NAME')
              self.assertEqual(item.Value, 'MdePkg')
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 2 other locations - About 1 hr to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 346..350
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 352..355

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

      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

          def testCValue(self):
              item = self.GetObj('gEfiIpSecProtocolGuid={ 0xdfb386f7, 0xe100, 0x43ad,'
                                 ' {0x9c, 0x9a, 0xed, 0x90, 0xd0, 0x8a, 0x5e, 0x12 }}')._ParseItem()
              self.assertEqual(item.GuidCName, 'gEfiIpSecProtocolGuid')
              self.assertEqual(item.GuidCValue, '{ 0xdfb386f7, 0xe100, 0x43ad, {0x9c, 0x9a, 0xed, 0x90, 0xd0, 0x8a, 0x5e, 0x12 }}')
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 2 other locations - About 1 hr to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 240..243
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 352..355

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

      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

          def testGuidString(self):
              item = self.GetObj('gEfiIpSecProtocolGuid=1E73767F-8F52-4603-AEB4-F29B510B6766')._ParseItem()
              self.assertEqual(item.GuidCName, 'gEfiIpSecProtocolGuid')
              self.assertEqual(item.GuidCValue, '1E73767F-8F52-4603-AEB4-F29B510B6766')
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 2 other locations - About 1 hr to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 240..243
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 346..350

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

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

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

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

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

      Refactorings

      Further Reading

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

          def GetObj(self, Content):
              Obj = _DecDefine(FileContent('dummy', Content.splitlines()))
              Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
              return Obj
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 1 other location - About 1 hr to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 261..264

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

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

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

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

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

      Refactorings

      Further Reading

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

          def GetObj(self, Content):
              Obj = _DecLibraryclass(FileContent('dummy', Content.splitlines()))
              Obj._RawData.CurrentLine = Obj._RawData.GetNextLine()
              return Obj
      Severity: Major
      Found in BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py and 1 other location - About 1 hr to fix
      BaseTools/Source/Python/UPT/UnitTest/DecParserUnitTest.py on lines 235..238

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

      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