hackedteam/vector-edk

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

Summary

Maintainability
C
1 day
Test Coverage

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

    def read_port_byte(self, io_port ):
        value = self.helper.read_io_port( io_port, 1 )
        if logger().VERBOSE:
            logger().log( "[io] reading byte from I/O port 0x%04X -> 0x%02X" % (io_port, value) )
        return value
Severity: Major
Found in vector-uefi/fd/tool/chipsec/hal/io.py and 2 other locations - About 2 hrs to fix
vector-uefi/fd/tool/chipsec/hal/io.py on lines 73..77
vector-uefi/fd/tool/chipsec/hal/io.py on lines 79..83

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

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_port_word(self, io_port ):
        value = self.helper.read_io_port( io_port, 2 )
        if logger().VERBOSE:
            logger().log( "[io] reading word from I/O port 0x%04X -> 0x%04X" % (io_port, value) )
        return value
Severity: Major
Found in vector-uefi/fd/tool/chipsec/hal/io.py and 2 other locations - About 2 hrs to fix
vector-uefi/fd/tool/chipsec/hal/io.py on lines 73..77
vector-uefi/fd/tool/chipsec/hal/io.py on lines 85..89

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

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_port_dword(self, io_port ):
        value = self.helper.read_io_port( io_port, 4 )
        if logger().VERBOSE:
            logger().log( "[io] reading dword from I/O port 0x%04X -> 0x%08X" % (io_port, value) )
        return value
Severity: Major
Found in vector-uefi/fd/tool/chipsec/hal/io.py and 2 other locations - About 2 hrs to fix
vector-uefi/fd/tool/chipsec/hal/io.py on lines 79..83
vector-uefi/fd/tool/chipsec/hal/io.py on lines 85..89

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

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_port_word(self, io_port, value ):
        if logger().VERBOSE:
            logger().log( "[io] writing word to I/O port 0x%04X <- 0x%04X" % (io_port, value) )
        self.helper.write_io_port( io_port, value, 2 )
        return
Severity: Major
Found in vector-uefi/fd/tool/chipsec/hal/io.py and 2 other locations - About 2 hrs to fix
vector-uefi/fd/tool/chipsec/hal/io.py on lines 92..96
vector-uefi/fd/tool/chipsec/hal/io.py on lines 104..108

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

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_port_byte(self, io_port, value ):
        if logger().VERBOSE:
            logger().log( "[io] writing byte to I/O port 0x%04X <- 0x%02X" % (io_port, value) )
        self.helper.write_io_port( io_port, value, 1 )
        return
Severity: Major
Found in vector-uefi/fd/tool/chipsec/hal/io.py and 2 other locations - About 2 hrs to fix
vector-uefi/fd/tool/chipsec/hal/io.py on lines 98..102
vector-uefi/fd/tool/chipsec/hal/io.py on lines 104..108

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

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_port_dword(self, io_port, value ):
        if logger().VERBOSE:
            logger().log( "[io] writing dword to I/O port 0x%04X <- 0x%08X" % (io_port, value) )
        self.helper.write_io_port( io_port, value, 4 )
        return
Severity: Major
Found in vector-uefi/fd/tool/chipsec/hal/io.py and 2 other locations - About 2 hrs to fix
vector-uefi/fd/tool/chipsec/hal/io.py on lines 92..96
vector-uefi/fd/tool/chipsec/hal/io.py on lines 98..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 50.

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