emonti/pliney

View on GitHub

Showing 4 of 6 total issues

File macho.rb has 463 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative 'io_helpers'
require_relative 'apple_code_signature'

# Note this implementation only works with little-endian mach-o binaries
# such as ARM and X86. Older PPC mach-o files are big-endian. Support could
Severity: Minor
Found in lib/pliney/macho.rb - About 7 hrs to fix

    Class IPA has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class IPA
            class ZipExtractError < StandardError
            end
    
            SYSTEM_HAS_UNZIP = system("which unzip > /dev/null")
    Severity: Minor
    Found in lib/pliney/ipa.rb - About 4 hrs to fix

      Method each_executable_entry has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

              def each_executable_entry
                  each_file_entry do |entry|
                      next if (zipstream = entry.get_input_stream).nil?
                      next if (magicbytes = zipstream.read(4)).nil?
                      next if (magic = magicbytes.unpack("N").first).nil?
      Severity: Minor
      Found in lib/pliney/ipa.rb - 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

      Method parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def self.parse(data)
                  obj = data.is_a?(StringStream)? data : StringStream.new(data)
                  magic = obj.read_uint32
                  n=FADEMAGIC[magic]
                  if n.nil? and ((magic >> 16) == 0xFADE)
      Severity: Minor
      Found in lib/pliney/apple_code_signature.rb - 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

      Severity
      Category
      Status
      Source
      Language