hackedteam/vector-edk

View on GitHub
vector-uefi/fd/tool/chipsec/hal/physmem.py

Summary

Maintainability
F
5 days
Test Coverage

Memory has 26 functions (exceeds 20 allowed). Consider refactoring.
Open

class Memory:
    def __init__( self, helper ):
        self.helper = helper

    ####################################################################################
Severity: Minor
Found in vector-uefi/fd/tool/chipsec/hal/physmem.py - About 3 hrs to fix

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

        def read_phys_mem_dword_64(self, phys_address_hi, phys_address_lo ):
            out_buf = self.read_phys_mem_64( phys_address_hi, phys_address_lo, 4 )
            try:
               value = struct.unpack( 'L', out_buf.raw )[0]
            except:
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 4 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 147..155
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 157..165

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

    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 read_phys_mem_word_64(self, phys_address_hi, phys_address_lo ):
            out_buf = self.read_phys_mem_64( phys_address_hi, phys_address_lo, 2 )
            try:
               value = struct.unpack( 'H', out_buf.raw )[0]
            except:
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 4 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 137..145
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 157..165

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

    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 read_phys_mem_byte_64(self, phys_address_hi, phys_address_lo ):
            out_buf = self.read_phys_mem_64( phys_address_hi, phys_address_lo, 1 )
            try:
               value = struct.unpack( 'B', out_buf.raw )[0]
            except:
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 4 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 137..145
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 147..155

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

    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 read_physical_mem_dword( self, phys_address ):
            out_buf = self.read_physical_mem( phys_address, 4 )
            value = struct.unpack( '=I', out_buf )[0]
            if logger().VERBOSE:
               logger().log( '[mem] dword at PA = 0x%016X: 0x%08X' % (phys_address, value) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 3 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 81..86
    vector-uefi/fd/tool/chipsec/hal/physmem.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 68.

    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 read_physical_mem_byte( self, phys_address ):
            out_buf = self.read_physical_mem( phys_address, 1 )
            value = struct.unpack( '=B', out_buf )[0]
            if logger().VERBOSE:
               logger().log( '[mem] byte at PA = 0x%016X: 0x%02X' % (phys_address, value) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 3 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 74..79
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 81..86

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

    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 read_physical_mem_word( self, phys_address ):
            out_buf = self.read_physical_mem( phys_address, 2 )
            value = struct.unpack( '=H', out_buf )[0]
            if logger().VERBOSE:
               logger().log( '[mem] word at PA = 0x%016X: 0x%04X' % (phys_address, value) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 3 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 74..79
    vector-uefi/fd/tool/chipsec/hal/physmem.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 68.

    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 write_phys_mem_byte_64( self, phys_address_hi, phys_address_lo, byte_value ):
            if logger().VERBOSE:
               logger().log( '[mem] byte to PA = 0x%08X_%08X <- 0x%02X' % (phys_address_hi, phys_address_lo, byte_value) )
            return self.write_phys_mem_64( phys_address_hi, phys_address_lo, 1, struct.pack( 'B', byte_value ) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 2 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 170..173
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 175..178

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

    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 write_phys_mem_word_64( self, phys_address_hi, phys_address_lo, word_value ):
            if logger().VERBOSE:
               logger().log( '[mem] word to PA = 0x%08X_%08X <- 0x%04X' % (phys_address_hi, phys_address_lo, word_value) )
            return self.write_phys_mem_64( phys_address_hi, phys_address_lo, 2, struct.pack( 'H', word_value ) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 2 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 170..173
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 180..183

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

    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 write_phys_mem_dword_64( self, phys_address_hi, phys_address_lo, dword_value ):
            if logger().VERBOSE:
               logger().log( '[mem] dword to PA = 0x%08X_%08X <- 0x%08X' % (phys_address_hi, phys_address_lo, dword_value) )
            return self.write_phys_mem_64( phys_address_hi, phys_address_lo, 4, struct.pack( 'I', dword_value ) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 2 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 175..178
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 180..183

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

    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 write_physical_mem_dword( self, phys_address, dword_value ):
            if logger().VERBOSE:
               logger().log( '[mem] dword to PA = 0x%016X <- 0x%08X' % (phys_address, dword_value) )
            return self.write_physical_mem( phys_address, 4, struct.pack( 'I', dword_value ) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 2 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 108..111
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 113..116

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

    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 write_physical_mem_word( self, phys_address, word_value ):
            if logger().VERBOSE:
               logger().log( '[mem] word to PA = 0x%016X <- 0x%04X' % (phys_address, word_value) )
            return self.write_physical_mem( phys_address, 2, struct.pack( 'H', word_value ) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 2 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 103..106
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 113..116

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

    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 write_physical_mem_byte( self, phys_address, byte_value ):
            if logger().VERBOSE:
               logger().log( '[mem] byte to PA = 0x%016X <- 0x%02X' % (phys_address, byte_value) )
            return self.write_physical_mem( phys_address, 1, struct.pack( 'B', byte_value ) )
    Severity: Major
    Found in vector-uefi/fd/tool/chipsec/hal/physmem.py and 2 other locations - About 2 hrs to fix
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 103..106
    vector-uefi/fd/tool/chipsec/hal/physmem.py on lines 108..111

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

    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