hackedteam/test-av

View on GitHub
lib/pefile/pefile.py

Summary

Maintainability
F
1 mo
Test Coverage

File pefile.py has 3140 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: Latin-1 -*-
"""pefile, Portable Executable reader module


All the PE file basic structures are available with their default names
Severity: Major
Found in lib/pefile/pefile.py - About 1 wk to fix

    Function dump_info has a Cognitive Complexity of 189 (exceeds 5 allowed). Consider refactoring.
    Open

        def dump_info(self, dump=None):
            """Dump all the PE header information into human readable string."""
            
            
            if dump is None:
    Severity: Minor
    Found in lib/pefile/pefile.py - About 3 days 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 parse_version_information has a Cognitive Complexity of 122 (exceeds 5 allowed). Consider refactoring.
    Open

        def parse_version_information(self, version_struct):
            """Parse version information structure.
            
            The date will be made available in three attributes of the PE object.
            
    Severity: Minor
    Found in lib/pefile/pefile.py - About 2 days 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

    PE has 73 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class PE:
        """A Portable Executable representation.
        
        This class provides access to most of the information in a PE file.
        
    Severity: Major
    Found in lib/pefile/pefile.py - About 1 day to fix

      Function write has a Cognitive Complexity of 68 (exceeds 5 allowed). Consider refactoring.
      Open

          def write(self, filename=None):
              """Write the PE file.
              
              This function will process all headers and components
              of the PE file and include all changes made (by just
      Severity: Minor
      Found in lib/pefile/pefile.py - About 1 day 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 parse_resources_directory has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_resources_directory(self, rva, size=0, base_rva = None, level = 0, dirs=None):
              """Parse the resources directory.
              
              Given the RVA of the resources directory, it will process all
              its entries.
      Severity: Minor
      Found in lib/pefile/pefile.py - About 1 day 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 __parse__ has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
      Open

          def __parse__(self, fname, data, fast_load):
              """Parse a Portable Executable file.
              
              Loads a PE file, parsing all its structures and making them available
              through the instance's attributes.
      Severity: Minor
      Found in lib/pefile/pefile.py - About 1 day 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 parse_export_directory has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_export_directory(self, rva, size):
              """Parse the export directory.
              
              Given the RVA of the export directory, it will process all
              its entries.
      Severity: Minor
      Found in lib/pefile/pefile.py - About 7 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_import_table has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_import_table(self, rva):
              
              table = []
      
              # We need the ordinal flag for a simple heuristic
      Severity: Minor
      Found in lib/pefile/pefile.py - About 5 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 parse_imports has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_imports(self, original_first_thunk, first_thunk, forwarder_chain):
              """Parse the imported symbols.
              
              It will fill a list, which will be available as the dictionary
              attribute "imports". Its keys will be the DLL names and the values
      Severity: Minor
      Found in lib/pefile/pefile.py - About 5 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_resources_strings has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_resources_strings(self):
              """Returns a list of all the strings found withing the resources (if any).
              
              This method will scan all entries in the resources directory of the PE, if
              there is one, and will return a list() with the strings.
      Severity: Minor
      Found in lib/pefile/pefile.py - About 4 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 parse_import_directory has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_import_directory(self, rva, size):
              """Walk and parse the import directory."""
              
              import_descs =  []
              while True:
      Severity: Minor
      Found in lib/pefile/pefile.py - About 3 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 parse_sections has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_sections(self, offset):
              """Fetch the PE file sections.
              
              The sections will be readily available in the "sections" attribute.
              Its attributes will contain all the section information plus "data"
      Severity: Minor
      Found in lib/pefile/pefile.py - About 3 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 __setattr__ has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def __setattr__(self, name, val):
      
              # If the instance doesn't yet have an ordinal attribute
              # it's not fully initialized so can't do any of the
              # following
      Severity: Minor
      Found in lib/pefile/pefile.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 parse_data_directories has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_data_directories(self, directories=None):
              """Parse and process the PE file's data directories.
              
              If the optional argument 'directories' is given, only
              the directories at the specified indices will be parsed.
      Severity: Minor
      Found in lib/pefile/pefile.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 dump has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def dump(self, indentation=0):
              """Returns a string representation of the structure."""
              
              dump = []
              
      Severity: Minor
      Found in lib/pefile/pefile.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 relocate_image has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def relocate_image(self, new_ImageBase):
              """Apply the relocation information to the image using the provided new image base.
              
              This method will apply the relocation information to the image. Given the new base,
              all the relocations will be processed and both the raw data and the section's data
      Severity: Minor
      Found in lib/pefile/pefile.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 parse_directory_bound_imports has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_directory_bound_imports(self, rva, size):
              """"""
              
              bnd_descr = Structure(self.__IMAGE_BOUND_IMPORT_DESCRIPTOR_format__)
              bnd_descr_size = bnd_descr.sizeof()
      Severity: Minor
      Found in lib/pefile/pefile.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 get_memory_mapped_image has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_memory_mapped_image(self, max_virtual_address=0x10000000, ImageBase=None):
              """Returns the data corresponding to the memory layout of the PE file.
              
              The data includes the PE header and the sections loaded at offsets
              corresponding to their relative virtual addresses. (the VirtualAddress
      Severity: Minor
      Found in lib/pefile/pefile.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 parse_delay_import_directory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def parse_delay_import_directory(self, rva, size):
              """Walk and parse the delay import directory."""
              
              import_descs =  []
              while True:
      Severity: Minor
      Found in lib/pefile/pefile.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 dump_info has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def dump_info(self, dump=None):
              """Dump all the PE header information into human readable string."""
              
              
              if dump is None:
      Severity: Minor
      Found in lib/pefile/pefile.py - About 1 hr to fix

        Function __setattr__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
        Open

            def __setattr__(self, name, val):
        
                # If the instance doesn't yet have an ordinal attribute
                # it's not fully initialized so can't do any of the
                # following
        Severity: Minor
        Found in lib/pefile/pefile.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 parse_strings has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

        def parse_strings(data, counter, l):
            i = 0
            error_count = 0
            while i < len(data):
                
        Severity: Minor
        Found in lib/pefile/pefile.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 __parse__ has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def __parse__(self, fname, data, fast_load):
                """Parse a Portable Executable file.
                
                Loads a PE file, parsing all its structures and making them available
                through the instance's attributes.
        Severity: Minor
        Found in lib/pefile/pefile.py - About 1 hr to fix

          Function parse_relocations_directory has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse_relocations_directory(self, rva, size):
                  """"""
                  
                  rlc_size = Structure(self.__IMAGE_BASE_RELOCATION_format__).sizeof()
                  end = rva+size
          Severity: Minor
          Found in lib/pefile/pefile.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 __set_format__ has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def __set_format__(self, format):
                  
                  offset = 0
                  for elm in format:
                      if ',' in elm:
          Severity: Minor
          Found in lib/pefile/pefile.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 add has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def add(self, txt, indent=0):
                  """Adds some text, no newline will be appended.
                  
                  The text can be indented with the optional argument 'indent'.
                  """
          Severity: Minor
          Found in lib/pefile/pefile.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 parse_rich_header has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def parse_rich_header(self):
                  """Parses the rich header
                  see http://www.ntcore.com/files/richsign.htm for more information
                  
                  Structure:
          Severity: Minor
          Found in lib/pefile/pefile.py - About 55 mins 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 parse_resources_directory has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def parse_resources_directory(self, rva, size=0, base_rva = None, level = 0, dirs=None):
          Severity: Minor
          Found in lib/pefile/pefile.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if new_stringtable_offset == stringtable_offset:
                                        break
                                    stringtable_offset = new_stringtable_offset
            Severity: Major
            Found in lib/pefile/pefile.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      for st_entry in entry.StringTable:
                                          [dump.add_line('  '+line) for line in st_entry.dump()]
                                          dump.add_line('  LangID: '+st_entry.LangID)
                                          dump.add_newline()
                                          for str_entry in st_entry.entries.items():
              Severity: Major
              Found in lib/pefile/pefile.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for st_entry in entry.StringTable:
                                            for key, entry in st_entry.entries.items():
                                                
                                                offsets = st_entry.entries_offsets[key]
                                                lengths = st_entry.entries_lengths[key]
                Severity: Major
                Found in lib/pefile/pefile.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if hasattr(resource_id, 'directory'):
                                              if hasattr(resource_id.directory, 'strings') and resource_id.directory.strings:
                                                  for res_string in resource_id.directory.strings.values():
                                                      resources_strings.append( res_string )
                                                      
                  Severity: Major
                  Found in lib/pefile/pefile.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            while varword_offset < orig_varword_offset + var_struct.ValueLength:
                                                word1 = self.get_word_from_data(
                                                    raw_data[varword_offset:varword_offset+2], 0)
                                                word2 = self.get_word_from_data(
                                                    raw_data[varword_offset+2:varword_offset+4], 0)
                    Severity: Major
                    Found in lib/pefile/pefile.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if not stringtable_struct:
                                                  break
                                              
                      Severity: Major
                      Found in lib/pefile/pefile.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                if hasattr(resource_id, 'directory'):
                                                    
                                                    resource_strings = dict()
                                                    
                                                    for resource_lang in resource_id.directory.entries:
                        Severity: Major
                        Found in lib/pefile/pefile.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if resource_id.name is not None:
                                                      dump.add_line('Name: [%s]' % resource_id.name, 6)
                                                  else:
                                                      dump.add_line('Id: [0x%X]' % resource_id.struct.Id, 6)
                                                  
                          Severity: Major
                          Found in lib/pefile/pefile.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    while entry_offset < stringtable_offset + stringtable_struct.Length:
                                                        
                                                        string_struct = self.__unpack_data__(
                                                            self.__String_format__, raw_data[entry_offset:],
                                                            file_offset = start_offset+entry_offset )
                            Severity: Major
                            Found in lib/pefile/pefile.py - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                                      if not var_struct:
                                                          break
                                                      
                              Severity: Major
                              Found in lib/pefile/pefile.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                        if hasattr(resource_id, 'directory'):
                                                            dump.add_lines(resource_id.directory.struct.dump(), 8)
                                                            
                                                            for resource_lang in resource_id.directory.entries:
                                                                if hasattr(resource_lang, 'data'):
                                Severity: Major
                                Found in lib/pefile/pefile.py - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                          if stringtable_offset >= stringfileinfo_struct.Length:
                                                              break
                                              
                                              # Parse a VarFileInfo entry
                                              #
                                  Severity: Major
                                  Found in lib/pefile/pefile.py - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                            if var_offset <= var_offset+var_struct.Length:
                                                                break
                                                    
                                                
                                                # Increment and align the offset
                                    Severity: Major
                                    Found in lib/pefile/pefile.py - About 45 mins to fix

                                      Avoid deeply nested control flow statements.
                                      Open

                                                              for var_entry in entry.Var:
                                                                  if hasattr(var_entry, 'entry'):
                                                                      [dump.add_line('  '+line) for line in var_entry.dump()]
                                                                      dump.add_line(
                                                                          '    ' + 
                                      Severity: Major
                                      Found in lib/pefile/pefile.py - About 45 mins to fix

                                        Function get_rva_from_offset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            def get_rva_from_offset(self, offset):
                                                """Get the RVA corresponding to this file offset. """
                                                
                                                s = self.get_section_by_offset(offset)
                                                if not s:
                                        Severity: Minor
                                        Found in lib/pefile/pefile.py - About 35 mins 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 __setattr__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            def __setattr__(self, name, val):
                                        
                                                # If the instance doesn't yet have a struct attribute
                                                # it's not fully initialized so can't do any of the
                                                # following
                                        Severity: Minor
                                        Found in lib/pefile/pefile.py - About 35 mins 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_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                            def get_data(self, rva=0, length=None):
                                                """Get data regardless of the section where it lies on.
                                                
                                                Given a RVA and the size of the chunk to retrieve, this method
                                                will find the section where the data lies and return the data.
                                        Severity: Minor
                                        Found in lib/pefile/pefile.py - About 35 mins 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

                                        Avoid too many return statements within this function.
                                        Open

                                                return table
                                        Severity: Major
                                        Found in lib/pefile/pefile.py - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                                  return ExportDirData(
                                          Severity: Major
                                          Found in lib/pefile/pefile.py - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                                    return []
                                            Severity: Major
                                            Found in lib/pefile/pefile.py - About 30 mins to fix

                                              Function get_overlay_data_start_offset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def get_overlay_data_start_offset(self):
                                                      """Get the offset of data appended to the file and not contained within the area described in the headers."""
                                              
                                                      highest_PointerToRawData = 0
                                                      highest_SizeOfRawData = 0
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py - About 25 mins 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 __setattr__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def __setattr__(self, name, val):
                                                  
                                                      if name == 'Characteristics':
                                                          section_flags = retrieve_flags(SECTION_CHARACTERISTICS, 'IMAGE_SCN_')
                                                          
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py - About 25 mins 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 adjust_SectionAlignment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def adjust_SectionAlignment( self, val, section_alignment, file_alignment ):
                                                      global SectionAlignment_Warning
                                                      if file_alignment < FILE_ALIGNEMNT_HARDCODED_VALUE:
                                                          if file_alignment != section_alignment and SectionAlignment_Warning is False:
                                                              self.__warnings.append(
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py - About 25 mins 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 __unpack__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def __unpack__(self, data):
                                                      
                                                      if len(data) > self.__format_length__:
                                                          data = data[:self.__format_length__]
                                                      
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py - About 25 mins 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_string_u_at_rva has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def get_string_u_at_rva(self, rva, max_length = 2**16):
                                                      """Get an Unicode string located at the given address."""
                                                      
                                                      try:
                                                          # If the RVA is invalid all would blow up. Some EXEs seem to be
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py - About 25 mins 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 __pack__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def __pack__(self):
                                                      
                                                      new_values = []
                                                      
                                                      for i in xrange(len(self.__unpacked_data_elms__)):
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py - About 25 mins 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

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

                                                      if hasattr(self, 'DIRECTORY_ENTRY_IMPORT'):
                                                          dump.add_header('Imported symbols')
                                                          for module in self.DIRECTORY_ENTRY_IMPORT:
                                                              dump.add_lines(module.struct.dump())
                                                              dump.add_newline()
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 day to fix
                                              lib/pefile/pefile.py on lines 4118..4137

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

                                              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

                                                      if hasattr(self, 'DIRECTORY_ENTRY_DELAY_IMPORT'):
                                                          dump.add_header('Delay Imported symbols')
                                                          for module in self.DIRECTORY_ENTRY_DELAY_IMPORT:
                                                              
                                                              dump.add_lines(module.struct.dump())
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 day to fix
                                              lib/pefile/pefile.py on lines 4083..4101

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

                                              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 parse_directory_load_config(self, rva, size):
                                                      """"""
                                                      
                                                      if self.PE_TYPE == OPTIONAL_HEADER_MAGIC_PE:
                                                          format = self.__IMAGE_LOAD_CONFIG_DIRECTORY_format__
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 day to fix
                                              lib/pefile/pefile.py on lines 2383..2406

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

                                              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 parse_directory_tls(self, rva, size):
                                                      """"""
                                                      
                                                      if self.PE_TYPE == OPTIONAL_HEADER_MAGIC_PE:
                                                          format = self.__IMAGE_TLS_DIRECTORY_format__
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 day to fix
                                              lib/pefile/pefile.py on lines 2409..2432

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

                                              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

                                                      if ( self.OPTIONAL_HEADER is None and
                                                          len(self.__data__[optional_header_offset:optional_header_offset+0x200])
                                                              >= MINIMUM_VALID_OPTIONAL_HEADER_RAW_SIZE ):
                                                          
                                                          # Add enough zeroes to make up for the unused fields
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 6 hrs to fix
                                              lib/pefile/pefile.py on lines 1843..1852

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

                                              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

                                                              if ( self.OPTIONAL_HEADER is None and
                                                                  len(self.__data__[optional_header_offset:optional_header_offset+0x200])
                                                                      >= MINIMUM_VALID_OPTIONAL_HEADER_RAW_SIZE ):
                                                                  
                                                                  padding_length = 128
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 6 hrs to fix
                                              lib/pefile/pefile.py on lines 1799..1814

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

                                              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

                                                                                  for idx, c in enumerate(entry):
                                                                                      if ord(c) > 256:
                                                                                          l.extend( [ chr(ord(c) & 0xff), chr( (ord(c) & 0xff00) >>8) ]  )
                                                                                      else:
                                                                                          l.extend( [chr( ord(c) ), '\0'] )
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 5 hrs to fix
                                              lib/pefile/pefile.py on lines 2132..2136

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

                                              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

                                                                                  for idx, c in enumerate(entry):
                                                                                      if ord(c) > 256:
                                                                                          l.extend( [ chr(ord(c) & 0xff), chr( (ord(c) & 0xff00) >>8) ]  )
                                                                                      else:
                                                                                          l.extend( [chr( ord(c) ), '\0'] )
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 5 hrs to fix
                                              lib/pefile/pefile.py on lines 2120..2124

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

                                              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 get_qword_from_data(self, data, offset):
                                                      """Convert eight bytes of data to a word (little endian)
                                                      
                                                      'offset' is assumed to index into a word array. So setting it to
                                                      N will return a dword out of the data starting at offset N*8.
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 4 hrs to fix
                                              lib/pefile/pefile.py on lines 4255..4267
                                              lib/pefile/pefile.py on lines 4312..4324

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

                                              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 get_dword_from_data(self, data, offset):
                                                      """Convert four bytes of data to a double word (little endian)
                                                      
                                                      'offset' is assumed to index into a dword array. So setting it to
                                                      N will return a dword out of the data starting at offset N*4.
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 4 hrs to fix
                                              lib/pefile/pefile.py on lines 4312..4324
                                              lib/pefile/pefile.py on lines 4368..4380

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

                                              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 get_word_from_data(self, data, offset):
                                                      """Convert two bytes of data to a word (little endian)
                                                      
                                                      'offset' is assumed to index into a word array. So setting it to
                                                      N will return a dword out of the data starting at offset N*2.
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 4 hrs to fix
                                              lib/pefile/pefile.py on lines 4255..4267
                                              lib/pefile/pefile.py on lines 4368..4380

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

                                              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

                                              image_characteristics = [
                                                  ('IMAGE_FILE_RELOCS_STRIPPED',          0x0001),
                                                  ('IMAGE_FILE_EXECUTABLE_IMAGE',         0x0002),
                                                  ('IMAGE_FILE_LINE_NUMS_STRIPPED',       0x0004),
                                                  ('IMAGE_FILE_LOCAL_SYMS_STRIPPED',      0x0008),
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 3 hrs to fix
                                              lib/pefile/pefile.py on lines 88..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 70.

                                              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

                                              directory_entry_types = [
                                                  ('IMAGE_DIRECTORY_ENTRY_EXPORT',        0),
                                                  ('IMAGE_DIRECTORY_ENTRY_IMPORT',        1),
                                                  ('IMAGE_DIRECTORY_ENTRY_RESOURCE',      2),
                                                  ('IMAGE_DIRECTORY_ENTRY_EXCEPTION',     3),
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 3 hrs to fix
                                              lib/pefile/pefile.py on lines 109..125

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

                                              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 get_word_from_offset(self, offset):
                                                      """Return the word value at the given file offset. (little endian)"""
                                                      
                                                      if offset+2 > len(self.__data__):
                                                          return None
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 4283..4289
                                              lib/pefile/pefile.py on lines 4396..4402

                                              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 get_qword_from_offset(self, offset):
                                                      """Return the quad-word value at the given file offset. (little endian)"""
                                                      
                                                      if offset+8 > len(self.__data__):
                                                          return None
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 4283..4289
                                              lib/pefile/pefile.py on lines 4340..4346

                                              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 get_dword_from_offset(self, offset):
                                                      """Return the double word value at the given file offset. (little endian)"""
                                                      
                                                      if offset+4 > len(self.__data__):
                                                          return None
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 4340..4346
                                              lib/pefile/pefile.py on lines 4396..4402

                                              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 convert_char(char):
                                                          if char in string.ascii_letters or char in string.digits or char in string.punctuation or char in string.whitespace:
                                                              return char
                                                          else:
                                                              return r'\x%02x' % ord(char)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/cuckoo/common/utils.py on lines 57..63

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

                                              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

                                                      try:
                                                          # If the RVA is invalid all would blow up. Some EXEs seem to be
                                                          # specially nasty and have an invalid RVA.
                                                          data = self.get_data(rva, Structure(self.__IMAGE_RESOURCE_DATA_ENTRY_format__).sizeof() )
                                                      except PEFormatError, excp:
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 2583..2591

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

                                                      try:
                                                          # If the RVA is invalid all would blow up. Some EXEs seem to be
                                                          # specially nasty and have an invalid RVA.
                                                          data = self.get_data(rva, Structure(self.__IMAGE_RESOURCE_DIRECTORY_format__).sizeof() )
                                                      except PEFormatError, e:
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 2783..2791

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

                                              def is_valid_dos_filename(s):
                                                  if s is None or not isinstance(s, str):
                                                      return False
                                                  for c in s:
                                                      if c not in allowed_filename:
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 1394..1400

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

                                              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 is_valid_function_name(s):
                                                  if s is None or not isinstance(s, str):
                                                      return False
                                                  for c in s:
                                                      if c not in allowed_function_name:
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 1380..1386

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

                                              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

                                                      if ( hasattr(self, 'DIRECTORY_ENTRY_LOAD_CONFIG') and
                                                           self.DIRECTORY_ENTRY_LOAD_CONFIG and
                                                           self.DIRECTORY_ENTRY_LOAD_CONFIG.struct ):
                                                           
                                                          dump.add_header('LOAD_CONFIG')
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 4192..4198

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

                                              subsystem_types = [
                                                  ('IMAGE_SUBSYSTEM_UNKNOWN',     0),
                                                  ('IMAGE_SUBSYSTEM_NATIVE',      1),
                                                  ('IMAGE_SUBSYSTEM_WINDOWS_GUI', 2),
                                                  ('IMAGE_SUBSYSTEM_WINDOWS_CUI', 3),
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 231..243

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

                                              relocation_types = [
                                                  ('IMAGE_REL_BASED_ABSOLUTE',        0),
                                                  ('IMAGE_REL_BASED_HIGH',            1),
                                                  ('IMAGE_REL_BASED_LOW',             2),
                                                  ('IMAGE_REL_BASED_HIGHLOW',         3),
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 188..200

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

                                                      if ( hasattr(self, 'DIRECTORY_ENTRY_TLS') and
                                                           self.DIRECTORY_ENTRY_TLS and
                                                           self.DIRECTORY_ENTRY_TLS.struct ):
                                                          
                                                          dump.add_header('TLS')
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 4201..4207

                                              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

                                                                      try:
                                                                          stringtable_string = self.get_string_u_at_rva( ustr_offset )
                                                                      except PEFormatError, excp:
                                                                          self.__warnings.append(
                                                                              'Error parsing the version information, ' +
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 2949..2956
                                              lib/pefile/pefile.py on lines 3121..3128

                                              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

                                                          try:
                                                              stringfileinfo_string = self.get_string_u_at_rva( ustr_offset )
                                                          except PEFormatError, excp:
                                                              self.__warnings.append(
                                                                  'Error parsing the version information, ' +
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 2995..3002
                                              lib/pefile/pefile.py on lines 3121..3128

                                              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

                                                                      try:
                                                                          var_string = self.get_string_u_at_rva( ustr_offset )
                                                                      except PEFormatError, excp:
                                                                          self.__warnings.append(
                                                                              'Error parsing the version information, ' +
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 2 hrs to fix
                                              lib/pefile/pefile.py on lines 2949..2956
                                              lib/pefile/pefile.py on lines 2995..3002

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

                                                              if self.struct_iat is not None:
                                                                  self.struct_iat.AddressOfData = val
                                                                  self.struct_iat.AddressOfData = self.struct_iat.AddressOfData
                                                                  self.struct_iat.Function = self.struct_iat.AddressOfData
                                                                  self.struct_iat.ForwarderString = self.struct_iat.AddressOfData
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 1181..1185

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

                                              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

                                                          try:
                                                              # If the RVA is invalid all would blow up. Some PEs seem to be
                                                              # specially nasty and have an invalid RVA.
                                                              data = self.get_data( rva, Structure(self.__IMAGE_DELAY_IMPORT_DESCRIPTOR_format__).sizeof() )
                                                          except PEFormatError, e:
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3387..3394

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

                                              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 get_section_by_rva(self, rva):
                                                      """Get the section containing the given address."""
                                                      
                                                      sections = [s for s in self.sections if s.contains_rva(rva)]
                                                      
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3904..3912

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

                                              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

                                                          elif name == 'address':
                                                              self.struct_table.AddressOfData = val
                                                              self.struct_table.Ordinal = self.struct_table.AddressOfData
                                                              self.struct_table.Function = self.struct_table.AddressOfData
                                                              self.struct_table.ForwarderString = self.struct_table.AddressOfData
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 1176..1180

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

                                              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 get_section_by_offset(self, offset):
                                                      """Get the section containing the given file offset."""
                                                      
                                                      sections = [s for s in self.sections if s.contains_offset(offset)]
                                                      
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3915..3923

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

                                              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

                                                          try:
                                                              # If the RVA is invalid all would blow up. Some EXEs seem to be
                                                              # specially nasty and have an invalid RVA.
                                                              data = self.get_data(rva, Structure(self.__IMAGE_IMPORT_DESCRIPTOR_format__).sizeof() )
                                                          except PEFormatError, e:
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3331..3338

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

                                              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

                                                                  stringtable_offset = self.dword_align(
                                                                      stringfileinfo_offset + stringfileinfo_struct.sizeof() +
                                                                          2*(len(stringfileinfo_string)+1),
                                                                      version_struct.OffsetToData)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3010..3013
                                              lib/pefile/pefile.py on lines 3100..3103

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

                                              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

                                                                          value_offset = self.dword_align(
                                                                              2*(len(key)+1) + entry_offset + string_struct.sizeof(),
                                                                              version_struct.OffsetToData)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3133..3135

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

                                              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

                                                                  var_offset = self.dword_align(
                                                                      stringfileinfo_offset + varfileinfo_struct.sizeof() +
                                                                          2*(len(stringfileinfo_string)+1),
                                                                      version_struct.OffsetToData)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 2974..2977
                                              lib/pefile/pefile.py on lines 3010..3013

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

                                              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

                                                                      entry_offset = self.dword_align(
                                                                          stringtable_offset + stringtable_struct.sizeof() +
                                                                              2*(len(stringtable_string)+1),
                                                                          version_struct.OffsetToData)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 2974..2977
                                              lib/pefile/pefile.py on lines 3100..3103

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

                                              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

                                                                      varword_offset = self.dword_align(
                                                                          2*(len(var_string)+1) + var_offset + var_struct.sizeof(),
                                                                          version_struct.OffsetToData)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3039..3041

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

                                              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 get_word_at_rva(self, rva):
                                                      """Return the word value at the given RVA.
                                                      
                                                      Returns None if the value can't be read, i.e. the RVA can't be mapped
                                                      to a file offset.
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 4270..4280
                                              lib/pefile/pefile.py on lines 4383..4393

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

                                              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 get_dword_at_rva(self, rva):
                                                      """Return the double word value at the given RVA.
                                                      
                                                      Returns None if the value can't be read, i.e. the RVA can't be mapped
                                                      to a file offset.
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 4327..4337
                                              lib/pefile/pefile.py on lines 4383..4393

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

                                              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 get_qword_at_rva(self, rva):
                                                      """Return the quad-word value at the given RVA.
                                                      
                                                      Returns None if the value can't be read, i.e. the RVA can't be mapped
                                                      to a file offset.
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 2 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 4270..4280
                                              lib/pefile/pefile.py on lines 4327..4337

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

                                              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

                                                          if rlc.VirtualAddress > self.OPTIONAL_HEADER.SizeOfImage:
                                                              self.__warnings.append(
                                                                  'Invalid relocation information. VirtualAddress outside' +
                                                                  ' of Image: 0x%x' % rlc.VirtualAddress)
                                                              break
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 2471..2475

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

                                              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

                                                          if rlc.SizeOfBlock > self.OPTIONAL_HEADER.SizeOfImage:
                                                              self.__warnings.append(
                                                                  'Invalid relocation information. SizeOfBlock too large' +
                                                                  ': %d' % rlc.SizeOfBlock)
                                                              break
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 2463..2467

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

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

                                              DEBUG_TYPE = dict([(e[1], e[0]) for e in debug_types]+debug_types)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

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

                                              SUBSYSTEM_TYPE = dict([(e[1], e[0]) for e in subsystem_types]+subsystem_types)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

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

                                              RESOURCE_TYPE = dict([(e[1], e[0]) for e in resource_type]+resource_type)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263

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

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

                                              IMAGE_CHARACTERISTICS = dict([(e[1], e[0]) for e in
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

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

                                              DIRECTORY_ENTRY = dict([(e[1], e[0]) for e in directory_entry_types]+directory_entry_types)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

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

                                              SECTION_CHARACTERISTICS = dict([(e[1], e[0]) for e in
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

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

                                              DLL_CHARACTERISTICS = dict([(e[1], e[0]) for e in dll_characteristics]+dll_characteristics)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 290..290

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

                                              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

                                              LANG = dict(lang+[(e[1], e[0]) for e in lang])
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 499..499

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

                                              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

                                                      for flag in image_flags:
                                                          if getattr(self.FILE_HEADER, flag[0]):
                                                              flags.append(flag[0])
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3978..3980

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

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

                                              MACHINE_TYPE = dict([(e[1], e[0]) for e in machine_types]+machine_types)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 245..245
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

                                              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

                                                      for flag in dll_characteristics_flags:
                                                          if getattr(self.OPTIONAL_HEADER, flag[0]):
                                                              flags.append(flag[0])
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 3964..3966

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

                                              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

                                              SUBLANG = dict(sublang+[(e[1], e[0]) for e in sublang])
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 1 other location - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 390..390

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

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

                                              RELOCATION_TYPE = dict([(e[1], e[0]) for e in relocation_types]+relocation_types)
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 8 other locations - About 1 hr to fix
                                              lib/pefile/pefile.py on lines 106..106
                                              lib/pefile/pefile.py on lines 127..127
                                              lib/pefile/pefile.py on lines 168..168
                                              lib/pefile/pefile.py on lines 185..185
                                              lib/pefile/pefile.py on lines 202..202
                                              lib/pefile/pefile.py on lines 228..228
                                              lib/pefile/pefile.py on lines 263..263
                                              lib/pefile/pefile.py on lines 290..290

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

                                              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

                                                      self.NT_HEADERS = self.__unpack_data__(
                                                          self.__IMAGE_NT_HEADERS_format__,
                                                          self.__data__[nt_headers_offset:nt_headers_offset+8],
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 50 mins to fix
                                              lib/pefile/pefile.py on lines 1831..1833

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

                                              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

                                                              self.OPTIONAL_HEADER = self.__unpack_data__(
                                                                  self.__IMAGE_OPTIONAL_HEADER64_format__,
                                                                  self.__data__[optional_header_offset:optional_header_offset+0x200],
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 50 mins to fix
                                              lib/pefile/pefile.py on lines 1744..1746

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

                                              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

                                                          elif name == 'forwarder':
                                                              # Complain if the length of the new name is longer than the existing one
                                                              if len(val) > len(self.forwarder):
                                                                  #raise Exception('The forwarder name provided is longer than the existing one.')
                                                                  pass
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 50 mins to fix
                                              lib/pefile/pefile.py on lines 1233..1238

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

                                              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

                                                          elif name == 'name':
                                                              # Complain if the length of the new name is longer than the existing one
                                                              if len(val) > len(self.name):
                                                                  #raise Exception('The export name provided is longer than the existing one.')
                                                                  pass
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 50 mins to fix
                                              lib/pefile/pefile.py on lines 1239..1244

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

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

                                                  def get_hash_sha1(self):
                                                      """Get the SHA-1 hex-digest of the section's data."""
                                                      
                                                      if sha1 is not None:
                                                          return sha1( self.get_data() ).hexdigest()
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 3 other locations - About 40 mins to fix
                                              lib/pefile/pefile.py on lines 1086..1090
                                              lib/pefile/pefile.py on lines 1093..1097
                                              lib/pefile/pefile.py on lines 1100..1104

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

                                              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

                                                              bnd_frwd_ref = self.__unpack_data__(
                                                                  self.__IMAGE_BOUND_FORWARDER_REF_format__,
                                                                  self.__data__[rva:rva+bnd_descr_size],
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 40 mins to fix
                                              lib/pefile/pefile.py on lines 2325..2327

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

                                              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

                                                          bnd_descr = self.__unpack_data__(
                                                              self.__IMAGE_BOUND_IMPORT_DESCRIPTOR_format__,
                                                                 self.__data__[rva:rva+bnd_descr_size],
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 40 mins to fix
                                              lib/pefile/pefile.py on lines 2348..2350

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

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

                                                  def get_hash_sha512(self):
                                                      """Get the SHA-512 hex-digest of the section's data."""
                                                      
                                                      if sha512 is not None:
                                                          return sha512( self.get_data() ).hexdigest()
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 3 other locations - About 40 mins to fix
                                              lib/pefile/pefile.py on lines 1079..1083
                                              lib/pefile/pefile.py on lines 1086..1090
                                              lib/pefile/pefile.py on lines 1100..1104

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

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

                                                  def get_hash_sha256(self):
                                                      """Get the SHA-256 hex-digest of the section's data."""
                                                      
                                                      if sha256 is not None:
                                                          return sha256( self.get_data() ).hexdigest()
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 3 other locations - About 40 mins to fix
                                              lib/pefile/pefile.py on lines 1079..1083
                                              lib/pefile/pefile.py on lines 1093..1097
                                              lib/pefile/pefile.py on lines 1100..1104

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

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

                                                  def get_hash_md5(self):
                                                      """Get the MD5 hex-digest of the section's data."""
                                                      
                                                      if md5 is not None:
                                                          return md5( self.get_data() ).hexdigest()
                                              Severity: Major
                                              Found in lib/pefile/pefile.py and 3 other locations - About 40 mins to fix
                                              lib/pefile/pefile.py on lines 1079..1083
                                              lib/pefile/pefile.py on lines 1086..1090
                                              lib/pefile/pefile.py on lines 1093..1097

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

                                              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

                                                          address_of_name_ordinals = self.get_data(
                                                              export_dir.AddressOfNameOrdinals, min( length_until_eof(export_dir.AddressOfNameOrdinals), export_dir.NumberOfNames*4) )
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 2 other locations - About 35 mins to fix
                                              lib/pefile/pefile.py on lines 3208..3209
                                              lib/pefile/pefile.py on lines 3212..3213

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

                                              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

                                                          address_of_names = self.get_data(
                                                              export_dir.AddressOfNames, min( length_until_eof(export_dir.AddressOfNames), export_dir.NumberOfNames*4))
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 2 other locations - About 35 mins to fix
                                              lib/pefile/pefile.py on lines 3210..3211
                                              lib/pefile/pefile.py on lines 3212..3213

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

                                              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

                                                          address_of_functions = self.get_data(
                                                              export_dir.AddressOfFunctions, min( length_until_eof(export_dir.AddressOfFunctions), export_dir.NumberOfFunctions*4) )
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 2 other locations - About 35 mins to fix
                                              lib/pefile/pefile.py on lines 3208..3209
                                              lib/pefile/pefile.py on lines 3210..3211

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

                                              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

                                                          if (addresses_of_data_set_64 and 
                                                              max(addresses_of_data_set_64) - min(addresses_of_data_set_64) > MAX_ADDRESS_SPREAD ):
                                                              return []
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 30 mins to fix
                                              lib/pefile/pefile.py on lines 3617..3619

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

                                                          if (addresses_of_data_set_32 and 
                                                              max(addresses_of_data_set_32) - min(addresses_of_data_set_32) > MAX_ADDRESS_SPREAD ):
                                                              return []
                                              Severity: Minor
                                              Found in lib/pefile/pefile.py and 1 other location - About 30 mins to fix
                                              lib/pefile/pefile.py on lines 3620..3622

                                              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