hackedteam/vector-edk

View on GitHub
vector-uefi/fd/tool/patch.py

Summary

Maintainability
F
1 wk
Test Coverage

Function patch has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def patch():
  global vol_address
  global vol_size

  print 'Patching volume'
Severity: Major
Found in vector-uefi/fd/tool/patch.py - About 2 hrs to fix

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

    def patch():
      global vol_address
      global vol_size
    
      print 'Patching volume'
    Severity: Major
    Found in vector-uefi/fd/tool/patch.py and 1 other location - About 4 days to fix
    vector-uefi/fd/tool/flash.py on lines 84..161

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

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

    if __name__ == "__main__":
        
        argv = sys.argv
        
        #import traceback
    Severity: Major
    Found in vector-uefi/fd/tool/patch.py and 2 other locations - About 3 days to fix
    vector-uefi/fd/tool/flash.py on lines 197..253
    vector-uefi/fd/tool/test.py on lines 195..251

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

    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

    def map_modname_zip(x):
        return ((x.split('/', 2)[2]).rpartition('.')[0]).replace('/','.')
    Severity: Major
    Found in vector-uefi/fd/tool/patch.py and 3 other locations - About 1 hr to fix
    vector-uefi/fd/tool/chipsec_util.py on lines 68..69
    vector-uefi/fd/tool/flash.py on lines 75..76
    vector-uefi/fd/tool/test.py on lines 75..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 41.

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

    def f_mod(x):
        return ( x.find('__init__') == -1 and MODFILE_RE.match(x) )
    Severity: Major
    Found in vector-uefi/fd/tool/patch.py and 9 other locations - About 30 mins to fix
    vector-uefi/fd/tool/chipsec/helper/oshelper.py on lines 58..59
    vector-uefi/fd/tool/chipsec_main.py on lines 88..89
    vector-uefi/fd/tool/chipsec_util.py on lines 66..67
    vector-uefi/fd/tool/chipsec_util.py on lines 72..73
    vector-uefi/fd/tool/flash.py on lines 73..74
    vector-uefi/fd/tool/flash.py on lines 79..80
    vector-uefi/fd/tool/patch.py on lines 73..74
    vector-uefi/fd/tool/test.py on lines 73..74
    vector-uefi/fd/tool/test.py on lines 79..80

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

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

    def f_mod_zip(x):
        return ( x.find('__init__') == -1 and ZIP_UTILCMD_RE.match(x) )
    Severity: Major
    Found in vector-uefi/fd/tool/patch.py and 9 other locations - About 30 mins to fix
    vector-uefi/fd/tool/chipsec/helper/oshelper.py on lines 58..59
    vector-uefi/fd/tool/chipsec_main.py on lines 88..89
    vector-uefi/fd/tool/chipsec_util.py on lines 66..67
    vector-uefi/fd/tool/chipsec_util.py on lines 72..73
    vector-uefi/fd/tool/flash.py on lines 73..74
    vector-uefi/fd/tool/flash.py on lines 79..80
    vector-uefi/fd/tool/patch.py on lines 79..80
    vector-uefi/fd/tool/test.py on lines 73..74
    vector-uefi/fd/tool/test.py on lines 79..80

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

    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