hackedteam/vector-edk

View on GitHub
ArmPlatformPkg/Scripts/Ds5/system_table.py

Summary

Maintainability
D
2 days
Test Coverage

Function load_symbols_at has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def load_symbols_at(self, addr, verbose = False):
        if self.DebugInfos == []:
            self.get_debug_info()
        
        found = False
Severity: Minor
Found in ArmPlatformPkg/Scripts/Ds5/system_table.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 get_debug_info has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def get_debug_info(self):
        # Get the information from EFI_DEBUG_IMAGE_INFO_TABLE_HEADER
        count = self.ec.getMemoryService().readMemory32(self.base + 0x4)
        if edk2_debugger.is_aarch64(self.ec):
            debug_info_table_base = self.ec.getMemoryService().readMemory64(self.base + 0x8)
Severity: Minor
Found in ArmPlatformPkg/Scripts/Ds5/system_table.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 get_configuration_table has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def get_configuration_table(self, conf_table_guid):
        if edk2_debugger.is_aarch64(self.ec):
            # Number of configuration Table entry
            conf_table_entry_count = self.ec.getMemoryService().readMemory32(self.system_table_base + 0x68)
Severity: Minor
Found in ArmPlatformPkg/Scripts/Ds5/system_table.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 load_all_symbols has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def load_all_symbols(self, verbose = False):
        if self.DebugInfos == []:
            self.get_debug_info()
        
        for debug_info in self.DebugInfos:
Severity: Minor
Found in ArmPlatformPkg/Scripts/Ds5/system_table.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def __init__(self, ec, membase, memsize):
        self.membase = membase
        self.memsize = memsize
        self.ec = ec
        
Severity: Minor
Found in ArmPlatformPkg/Scripts/Ds5/system_table.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

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

                if edk2_debugger.is_aarch64(self.ec):
                    section = firmware_volume.EfiSectionPE64(self.ec, debug_info[0])
                else:
                    section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])
Severity: Major
Found in ArmPlatformPkg/Scripts/Ds5/system_table.py and 1 other location - About 2 hrs to fix
ArmPlatformPkg/Scripts/Ds5/system_table.py on lines 95..98

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

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 edk2_debugger.is_aarch64(self.ec):
                section = firmware_volume.EfiSectionPE64(self.ec, debug_info[0])
            else:
                section = firmware_volume.EfiSectionPE32(self.ec, debug_info[0])
Severity: Major
Found in ArmPlatformPkg/Scripts/Ds5/system_table.py and 1 other location - About 2 hrs to fix
ArmPlatformPkg/Scripts/Ds5/system_table.py on lines 73..76

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

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

                try:
                    edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)
                except Exception, (ErrorClass, ErrorMessage):
                    if verbose:
                        print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)
Severity: Major
Found in ArmPlatformPkg/Scripts/Ds5/system_table.py and 3 other locations - About 2 hrs to fix
ArmPlatformPkg/Scripts/Ds5/firmware_volume.py on lines 330..334
ArmPlatformPkg/Scripts/Ds5/firmware_volume.py on lines 350..354
ArmPlatformPkg/Scripts/Ds5/system_table.py on lines 100..104

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

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

            try:
                edk2_debugger.load_symbol_from_file(self.ec, section.get_debug_filepath(), section.get_debug_elfbase(), verbose)
            except Exception, (ErrorClass, ErrorMessage):
                if verbose:
                    print "Error while loading a symbol file (%s: %s)" % (ErrorClass, ErrorMessage)
Severity: Major
Found in ArmPlatformPkg/Scripts/Ds5/system_table.py and 3 other locations - About 2 hrs to fix
ArmPlatformPkg/Scripts/Ds5/firmware_volume.py on lines 330..334
ArmPlatformPkg/Scripts/Ds5/firmware_volume.py on lines 350..354
ArmPlatformPkg/Scripts/Ds5/system_table.py on lines 78..82

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