davispuh/ruby-libmspack

View on GitHub

Showing 8 of 8 total issues

File mscab.rb has 290 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module LibMsPack
    module MsCab
        module Constants
            # Offset from start of cabinet to the reserved header data (if present).
            MSCAB_HDR_RESV_OFFSET = 0x28
Severity: Minor
Found in lib/libmspack/mscab.rb - About 2 hrs to fix

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

            class MsSzddDecompressor < FFI::Struct
                layout({
                    :open => callback([ :pointer, :string ], :pointer),
                    :close => callback([ :pointer, :pointer ], :void),
                    :extract => callback([ :pointer, :pointer, :string ], :int),
    Severity: Major
    Found in lib/libmspack/msszdd.rb and 1 other location - About 1 hr to fix
    lib/libmspack/mskwaj.rb on lines 93..119

    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

            class MsKwajDecompressor < FFI::Struct
                layout({
                    :open => callback([ :pointer, :string ], :pointer),
                    :close => callback([ :pointer, :pointer ], :void),
                    :extract => callback([ :pointer, :pointer, :string ], :int),
    Severity: Major
    Found in lib/libmspack/mskwaj.rb and 1 other location - About 1 hr to fix
    lib/libmspack/msszdd.rb on lines 50..76

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 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

    Method fast_find has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

                def fast_find(decompressor, chm, filename, file, size)
    Severity: Minor
    Found in lib/libmspack/mschm.rb - About 35 mins to fix

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

              class MsoabDecompressor < FFI::Struct
                  layout({
                      :decompress => callback([ :pointer, :string, :string ], :int),
                      :decompress_incremental => callback([ :pointer, :string, :string, :string ], :int)
                  })
      Severity: Minor
      Found in lib/libmspack/msoab.rb and 1 other location - About 25 mins to fix
      lib/libmspack/msoab.rb on lines 3..14

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

      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

              class MsoabCompressor < FFI::Struct
                  layout({
                      :compress => callback([ :pointer, :string, :string ], :int),
                      :compress_incremental => callback([ :pointer, :string, :string, :string ], :int)
                  })
      Severity: Minor
      Found in lib/libmspack/msoab.rb and 1 other location - About 25 mins to fix
      lib/libmspack/msoab.rb on lines 19..30

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

      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 open(filename)
                      raise Exceptions::NotInitializedError unless @Decompressor
                      cabinet = @Decompressor.open(@Decompressor, filename)
                      error = lastError
                      raise Exceptions::LibMsPackError.new(error) unless error == LibMsPack::MSPACK_ERR_OK
      Severity: Minor
      Found in lib/libmspack/mscab.rb and 1 other location - About 15 mins to fix
      lib/libmspack/mscab.rb on lines 626..631

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

      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 search(filename)
                      raise Exceptions::NotInitializedError unless @Decompressor
                      cabinet = @Decompressor.search(@Decompressor, filename)
                      error = lastError
                      raise Exceptions::LibMsPackError.new(error) unless error == LibMsPack::MSPACK_ERR_OK
      Severity: Minor
      Found in lib/libmspack/mscab.rb and 1 other location - About 15 mins to fix
      lib/libmspack/mscab.rb on lines 579..584

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

      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

      Severity
      Category
      Status
      Source
      Language