ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

Non-local exit from iterator, without return value. next, break, Array#find, Array#any?, etc. is preferred.
Open

    return if @glinestree < 1

This cop checks for non-local exits from iterators without a return value. It registers an offense under these conditions:

  • No value is returned,
  • the block is preceded by a method chain,
  • the block has arguments,
  • the method which receives the block is not define_method or define_singleton_method,
  • the return is not contained in an inner scope, e.g. a lambda or a method definition.

Example:

class ItemApi
  rescue_from ValidationError do |e| # non-iteration block with arg
    return { message: 'validation error' } unless e.errors # allowed
    error_array = e.errors.map do |error| # block with method chain
      return if error.suppress? # warned
      return "#{error.param}: invalid" unless error.message # allowed
      "#{error.param}: #{error.message}"
    end
    { message: 'validation error', errors: error_array }
  end

  def update_items
    transaction do # block without arguments
      return unless update_necessary? # allowed
      find_each do |item| # block without method chain
        return if item.stock == 0 # false-negative...
        item.update!(foobar: true)
      end
    end
  end
end

Useless assignment to variable - result.
Open

  result = false

This cop checks for every useless assignment to local variable in every scope. The basic idea for this cop was from the warning of ruby -cw:

assigned but unused variable - foo

Currently this cop has advanced logic that detects unreferenced reassignments and properly handles varied cases such as branch, loop, rescue, ensure, etc.

Example:

# bad

def some_method
  some_var = 1
  do_something
end

Example:

# good

def some_method
  some_var = 1
  do_something(some_var)
end

Avoid more than 3 levels of block nesting.
Open

          puts "    [+] Pattern found at 0x#{(secAddr + i + pattAddr).to_s(16)} fast disassembling in process..." if defined?($VERBOSEOPT)

This cop checks for excessive nesting of conditional and looping constructs.

You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

The maximum level of nesting allowed is configurable.

Avoid more than 3 levels of block nesting.
Open

          if (ctb[debstr, ctbptr - debstr] !~ /([\x7f-\xff]|[\x01-\x08]|[\x0b-\x1f])/n) && (ctb[debstr, ctbptr - debstr].length > 4)
            tbstrings << [tdi.address, ctb[debstr, ctbptr - debstr]]
          end

This cop checks for excessive nesting of conditional and looping constructs.

You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

The maximum level of nesting allowed is configurable.

Line is too long. [98/80]
Open

                  ['PKCS_sha1', ["\x30\x21\x30\x09\x06\x05\x2b\x24\x03\x02\x01\x05\x00\x04\x14"]],

Line is too long. [550/80]
Open

                  ['HAVAL_mc5', ["\x50\xf0\x3b\xba\x98\x2a\xfb\x7e\x1d\x65\xf1\xa1\x76\x01\xaf\x39\x3e\x59\xca\x66\x88\x0e\x43\x82\x19\x86\xee\x8c\xb4\x9f\x6f\x45\xc3\xa5\x84\x7d\xbe\x5e\x8b\x3b\xd8\x75\x6f\xe0\x73\x20\xc1\x85\x9f\x44\x1a\x40\xa6\x6a\xc1\x56\x62\xaa\xd3\x4e\x06\x77\x3f\x36\x72\xdf\xfe\x1b\x3d\x02\x9b\x42\x24\xd7\xd0\x37\x48\x12\x0a\xd0\xd3\xea\x0f\xdb\x9b\xc0\xf1\x49\xc9\x72\x53\x07\x7b\x1b\x99\x80\xd8\x79\xd4\x25\xf7\xde\xe8\xf6\x1a\x50\xfe\xe3\x3b\x4c\x79\xb6\xbd\xe0\x6c\x97\xba\x06\xc0\x04\xb6\x4f\xa9\xc1\xc4\x60\x9f\x40"]],

Line is too long. [508/80]
Open

                  ['SQUARE_encryption_table', ["\x26\xb1\xb1\x97\xa7\xce\xce\x69\xb0\xc3\xc3\x73\x4a\x95\x95\xdf\xee\x5a\x5a\xb4\x02\xad\xad\xaf\xdc\xe7\xe7\x3b\x06\x02\x02\x04\xd7\x4d\x4d\x9a\xcc\x44\x44\x88\xf8\xfb\xfb\x03\x46\x91\x91\xd7\x14\x0c\x0c\x18\x7c\x87\x87\xfb\x16\xa1\xa1\xb7\xf0\x50\x50\xa0\xa8\xcb\xcb\x63\xa9\x67\x67\xce\xfc\x54\x54\xa8\x92\xdd\xdd\x4f\xca\x46\x46\x8c\x64\x8f\x8f\xeb\xd6\xe1\xe1\x37\xd2\x4e\x4e\x9c\xe5\xf0\xf0\x15\xf2\xfd\xfd\x0f\xf1\xfc\xfc\x0d\xc8\xeb\xeb\x23\xfe\xf9"]],

Line is too long. [293/80]
Open

                  ['SHARK_iG', ["\xe7\x30\x90\x85\xd0\x4b\x91\x41\x53\x95\x9b\xa5\x96\xbc\xa1\x68\x02\x45\xf7\x65\x5c\x1f\xb6\x52\xa2\xca\x22\x94\x44\x63\x2a\xa2\xfc\x67\x8e\x10\x29\x75\x85\x71\x24\x45\xa2\xcf\x2f\x22\xc1\x0e\xa1\xf1\x71\x40\x91\x27\x18\xa5\x56\xf4\xaf\x32\xd2\xa4\xdc\x71"]],

Line is too long. [472/80]
Open

                  ['SAFER_exp_table', ["\x01\x2d\xe2\x93\xbe\x45\x15\xae\x78\x03\x87\xa4\xb8\x38\xcf\x3f\x08\x67\x09\x94\xeb\x26\xa8\x6b\xbd\x18\x34\x1b\xbb\xbf\x72\xf7\x40\x35\x48\x9c\x51\x2f\x3b\x55\xe3\xc0\x9f\xd8\xd3\xf3\x8d\xb1\xff\xa7\x3e\xdc\x86\x77\xd7\xa6\x11\xfb\xf4\xba\x92\x91\x64\x83\xf1\x33\xef\xda\x2c\xb5\xb2\x2b\x88\xd1\x99\xcb\x8c\x84\x1d\x14\x81\x97\x71\xca\x5f\xa3\x8b\x57\x3c\x82\xc4\x52\x5c\x1c\xe8\xa0\x04\xb4\x85\x4a\xf6\x13\x54\xb6\xdf\x0c\x1a"]],

Line is too long. [452/80]
Open

                  ['SAFER_log_table', ["\x80\x00\xb0\x09\x60\xef\xb9\xfd\x10\x12\x9f\xe4\x69\xba\xad\xf8\xc0\x38\xc2\x65\x4f\x06\x94\xfc\x19\xde\x6a\x1b\x5d\x4e\xa8\x82\x70\xed\xe8\xec\x72\xb3\x15\xc3\xff\xab\xb6\x47\x44\x01\xac\x25\xc9\xfa\x8e\x41\x1a\x21\xcb\xd3\x0d\x6e\xfe\x26\x58\xda\x32\x0f\x20\xa9\x9d\x84\x98\x05\x9c\xbb\x22\x8c\x63\xe7\xc5\xe1\x73\xc6\xaf\x24\x5b\x87\x66\x27\xf7\x57\xf4\x96\xb1\xb7\x5c\x8b\xd5\x54\x79\xdf\xaa\xf6\x3e\xa3"]],

end at 479, 17 is not aligned with if at 475, 15.
Open

                 end

This cop checks whether the end keywords are aligned properly.

Three modes are supported through the EnforcedStyleAlignWith configuration parameter:

If it's set to keyword (which is the default), the end shall be aligned with the start of the keyword (if, class, etc.).

If it's set to variable the end shall be aligned with the left-hand-side of the variable assignment, if there is one.

If it's set to start_of_line, the end shall be aligned with the start of the line where the matching keyword appears.

Example: EnforcedStyleAlignWith: keyword (default)

# bad

variable = if true
    end

# good

variable = if true
           end

Example: EnforcedStyleAlignWith: variable

# bad

variable = if true
    end

# good

variable = if true
end

Example: EnforcedStyleAlignWith: startofline

# bad

variable = if true
    end

# good

puts(if true
end)

Line is too long. [1069/80]
Open

                  ['SQUARE_SHARK_dec', ["\x35\xbe\x07\x2e\x53\x69\xdb\x28\x6f\xb7\x76\x6b\x0c\x7d\x36\x8b\x92\xbc\xa9\x32\xac\x38\x9c\x42\x63\xc8\x1e\x4f\x24\xe5\xf7\xc9\x61\x8d\x2f\x3f\xb3\x65\x7f\x70\xaf\x9a\xea\xf5\x5b\x98\x90\xb1\x87\x71\x72\xed\x37\x45\x68\xa3\xe3\xef\x5c\xc5\x50\xc1\xd6\xca\x5a\x62\x5f\x26\x09\x5d\x14\x41\xe8\x9d\xce\x40\xfd\x08\x17\x4a\x0f\xc7\xb4\x3e\x12\xfc\x25\x4b\x81\x2c\x04\x78\xcb\xbb\x20\xbd\xf9\x29\x99\xa8\xd3\x60\xdf\x11\x97\x89\x7e\xfa\xe0\x9b\x1f\xd2\x67\xe2\x64\x77\x84\x2b\x9e\x8a\xf1\x6d\x88\x79\x74\x57\xdd\xe6\x39\x7b\xee\x83\xe1\x58\xf2\x0d\x34\xf8\x30\xe9\xb9\x23\x54\x15\x44\x0b\x4d\x66\x3a\x03\xa2\x91\x94\x52\x4c\xc3\x82\xe7\x80\xc0\xb6\x0e\xc2\x6c\x93\xec\xab\x43\x95\xf6\xd8\x46\x86\x05\x8c\xb0\x75\x00\xcc\x85\xd7\x3d\x73\x7a\x48\xe4\xd1\x59\xad\xb8\xc6\xd0\xdc\xa1\xaa\x02\x1d\xbf\xb5\x9f\x51\xc4\xa5\x10\x22\xcf\x01\xba\x8f\x31\x7c\xae\x96\xda\xf0\x56\x47\xd4\xeb\x4e\xd9\x13\x8e\x49\x55\x16\xff\x3b\xf4\xa4\xb2\x06\xa0\xa7\xfb\x1b\x6e\x3c\x33\xcd\x18\x5e\x6a\xd5\xa6\x21\xde\xfe\x2a\x1c\xf3\x0a\x1a\x19\x27\x2d"]],

Line is too long. [509/80]
Open

                  ['zdeflate_lengthCodes', ["\x01\x01\x00\x00\x02\x01\x00\x00\x03\x01\x00\x00\x04\x01\x00\x00\x05\x01\x00\x00\x06\x01\x00\x00\x07\x01\x00\x00\x08\x01\x00\x00\x09\x01\x00\x00\x09\x01\x00\x00\x0a\x01\x00\x00\x0a\x01\x00\x00\x0b\x01\x00\x00\x0b\x01\x00\x00\x0c\x01\x00\x00\x0c\x01\x00\x00\x0d\x01\x00\x00\x0d\x01\x00\x00\x0d\x01\x00\x00\x0d\x01\x00\x00\x0e\x01\x00\x00\x0e\x01\x00\x00\x0e\x01\x00\x00\x0e\x01\x00\x00\x0f\x01\x00\x00\x0f\x01\x00\x00\x0f\x01\x00\x00\x0f\x01\x00\x00\x10\x01\x00"]],

Line is too long. [475/80]
Open

                  ['camellia_s', ["\x70\x82\x2c\xec\xb3\x27\xc0\xe5\xe4\x85\x57\x35\xea\x0c\xae\x41\x23\xef\x6b\x93\x45\x19\xa5\x21\xed\x0e\x4f\x4e\x1d\x65\x92\xbd\x86\xb8\xaf\x8f\x7c\xeb\x1f\xce\x3e\x30\xdc\x5f\x5e\xc5\x0b\x1a\xa6\xe1\x39\xca\xd5\x47\x5d\x3d\xd9\x01\x5a\xd6\x51\x56\x6c\x4d\x8b\x0d\x9a\x66\xfb\xcc\xb0\x2d\x74\x12\x2b\x20\xf0\xb1\x84\x99\xdf\x4c\xcb\xc2\x34\x7e\x76\x05\x6d\xb7\xa9\x31\xd1\x17\x04\xd7\x14\x58\x3a\x61\xde\x1b\x11\x1c\x32\x0f\x9c\x16\x53"]],

Line is too long. [486/80]
Open

                  ['CRC32', ["\x00\x00\x00\x00\x96\x30\x07\x77\x2c\x61\x0e\xee\xba\x51\x09\x99\x19\xc4\x6d\x07\x8f\xf4\x6a\x70\x35\xa5\x63\xe9\xa3\x95\x64\x9e\x32\x88\xdb\x0e\xa4\xb8\xdc\x79\x1e\xe9\xd5\xe0\x88\xd9\xd2\x97\x2b\x4c\xb6\x09\xbd\x7c\xb1\x7e\x07\x2d\xb8\xe7\x91\x1d\xbf\x90\x64\x10\xb7\x1d\xf2\x20\xb0\x6a\x48\x71\xb9\xf3\xde\x41\xbe\x84\x7d\xd4\xda\x1a\xeb\xe4\xdd\x6d\x51\xb5\xd4\xf4\xc7\x85\xd3\x83\x56\x98\x6c\x13\xc0\xa8\x6b\x64\x7a\xf9\x62\xfd\xec\xc9\x65\x8a\x4f"]],

Line is too long. [486/80]
Open

                  ['Twofish_q', ["\xa9\x67\xb3\xe8\x04\xfd\xa3\x76\x9a\x92\x80\x78\xe4\xdd\xd1\x38\x0d\xc6\x35\x98\x18\xf7\xec\x6c\x43\x75\x37\x26\xfa\x13\x94\x48\xf2\xd0\x8b\x30\x84\x54\xdf\x23\x19\x5b\x3d\x59\xf3\xae\xa2\x82\x63\x01\x83\x2e\xd9\x51\x9b\x7c\xa6\xeb\xa5\xbe\x16\x0c\xe3\x61\xc0\x8c\x3a\xf5\x73\x2c\x25\x0b\xbb\x4e\x89\x6b\x53\x6a\xb4\xf1\xe1\xe6\xbd\x45\xe2\xf4\xb6\x66\xcc\x95\x03\x56\xd4\x1c\x1e\xd7\xfb\xc3\x8e\xb5\xe9\xcf\xbf\xba\xea\x77\x39\xaf\x33\xc9\x62\x71"]],

Line is too long. [472/80]
Open

                  ['Blowfish_s_init', ["\xa6\x0b\x31\xd1\xac\xb5\xdf\x98\xdb\x72\xfd\x2f\xb7\xdf\x1a\xd0\xed\xaf\xe1\xb8\x96\x7e\x26\x6a\x45\x90\x7c\xba\x99\x7f\x2c\xf1\x47\x99\xa1\x24\xf7\x6c\x91\xb3\xe2\xf2\x01\x08\x16\xfc\x8e\x85\xd8\x20\x69\x63\x69\x4e\x57\x71\xa3\xfe\x58\xa4\x7e\x3d\x93\xf4\x8f\x74\x95\x0d\x58\xb6\x8e\x72\x58\xcd\x8b\x71\xee\x4a\x15\x82\x1d\xa4\x54\x7b\xb5\x59\x5a\xc2\x39\xd5\x30\x9c\x13\x60\xf2\x2a\x23\xb0\xd1\xc5\xf0\x85\x60\x28\x18\x79\x41"]],

Line is too long. [464/80]
Open

                  ['SQUARE_decryption_table', ["\x02\xbc\x68\xe3\x0c\x62\x85\x55\x31\x23\x3f\x2a\xf7\x13\xab\x61\x72\x6d\xd4\x98\x19\x9a\xcb\x21\x61\xa4\x22\x3c\xcd\x3d\x9d\x45\x23\xb4\xfd\x05\x5f\x07\xc4\x2b\xc0\x01\x2c\x9b\x0f\x80\xd9\x3d\x74\x5c\x6c\x48\x85\x7e\x7f\xf9\x1f\xab\x73\xf1\x0e\xde\xed\xb6\xed\x6b\x3c\x28\x1a\x78\x97\x49\x8d\x91\x2a\x9f\x33\x9f\x57\xc9\xaa\xa8\x07\xa9\x7d\xed\x0d\xa5\x8f\x2d\x42\x7c\xc9\xb0\x4d\x76\x57\xe8\x91\x4d\xcc\x63\xa9"]],

Line is too long. [473/80]
Open

                  ['Square/SHARK_decryption_SBOX', ["\x35\xbe\x07\x2e\x53\x69\xdb\x28\x6f\xb7\x76\x6b\x0c\x7d\x36\x8b\x92\xbc\xa9\x32\xac\x38\x9c\x42\x63\xc8\x1e\x4f\x24\xe5\xf7\xc9\x61\x8d\x2f\x3f\xb3\x65\x7f\x70\xaf\x9a\xea\xf5\x5b\x98\x90\xb1\x87\x71\x72\xed\x37\x45\x68\xa3\xe3\xef\x5c\xc5\x50\xc1\xd6\xca\x5a\x62\x5f\x26\x09\x5d\x14\x41\xe8\x9d\xce\x40\xfd\x08\x17\x4a\x0f\xc7\xb4\x3e\x12\xfc\x25\x4b\x81\x2c\x04\x78\xcb\xbb\x20\xbd\xf9\x29\x99\xa8\xd3\x60\xdf\x11"]],

Line is too long. [469/80]
Open

                  ['Square/SHARK_encryption_SBOX', ["\xb1\xce\xc3\x95\x5a\xad\xe7\x02\x4d\x44\xfb\x91\x0c\x87\xa1\x50\xcb\x67\x54\xdd\x46\x8f\xe1\x4e\xf0\xfd\xfc\xeb\xf9\xc4\x1a\x6e\x5e\xf5\xcc\x8d\x1c\x56\x43\xfe\x07\x61\xf8\x75\x59\xff\x03\x22\x8a\xd1\x13\xee\x88\x00\x0e\x34\x15\x80\x94\xe3\xed\xb5\x53\x23\x4b\x47\x17\xa7\x90\x35\xab\xd8\xb8\xdf\x4f\x57\x9a\x92\xdb\x1b\x3c\xc8\x99\x04\x8e\xe0\xd7\x7d\x85\xbb\x40\x2c\x3a\x45\xf1\x42\x65\x20\x41\x18\x72\x25\x93"]],
Severity
Category
Status
Source
Language