ANSSI-FR/polichombr

View on GitHub

Showing 1,243 of 1,244 total issues

Line is too long. [244/80]
Open

    comment += ' ' + dasm.di_at(di.instruction.args.last.symbolic.target.bind.reduce).to_s if !dasm.di_at(di.instruction.args.last.symbolic.target).nil? && !comment.include?(dasm.di_at(di.instruction.args.last.symbolic.target.bind.reduce).to_s)

Line is too long. [109/80]
Open

            fd.puts '        "0x' + curblock.to_s(16) + '" -> "0x' + dest_addr.to_s(16) + '" [color="blue"];'

Line is too long. [187/80]
Open

        cblock += '\\l| ' unless (di.block.list.last.address == di.address) && !dasm.di_at(di.next_addr).block.from_normal.nil? && (dasm.di_at(di.next_addr).block.from_normal.length == 1)

Space missing after comma.
Open

  datas = datas.gsub(call_stub, "<a xlink:href=\"#{call_stub.split('_at_0x')[1].split('_')[0]}\" stroke-width=\"0.7\" stroke=\"blue\" fill=\"blue\">#{call_stub.split('_at_0x')[0].gsub('_','_<!-- -->')}</a><a xlink:href=\"javascript:displayRenameBox(0x#{call_stub.split('_at_0x')[1].split('_')[0]});\" stroke-width=\"0.6\" stroke=\"#80c000\" fill=\"#80c000\">[R]</a>")

Checks for comma (,) not followed by some kind of space.

Example:

# bad
[1,2]
{ foo:bar,}

# good
[1, 2]
{ foo:bar, }

Line is too long. [145/80]
Open

    datas = datas.gsub(call_stub, "<a xlink:href=\"#\" stroke-width=\"0.7\" stroke=\"red\" fill=\"red\">#{call_stub.gsub('_', '_<!-- -->')}</a>")

Don't use parentheses around a method call.
Open

  datas = datas.gsub(call_stub, "<a xlink:href=\"#{call_stub.split('loc_')[1].split('h')[0]}\" stroke-width=\"0.7\" stroke=\"blue\" fill=\"blue\">#{call_stub}</a><a xlink:href=\"javascript:displayRenameBox(0x#{(call_stub.scan(/[a-f0-9]{3,}/))[1]});\" stroke-width=\"0.6\" stroke=\"#80c000\" fill=\"#80c000\">[R]</a>")

This cop checks for redundant parentheses.

Example:

# bad
(x) if ((y.z).nil?)

# good
x if y.z.nil?

Line is too long. [126/80]
Open

      comment += " #{dasm.backtrace(di.instruction.args.last.symbolic(di), di.address, origin: di.address, type: :x).reduce}("

Line is too long. [98/80]
Open

  if (dasm.normalize(di.instruction.args.last).is_a? Integer) && (di.instruction.args.length == 2)

Line is too long. [86/80]
Open

      # pp dasm.decode_dword(dasm.normalize(di.instruction.args.last.symbolic.target))

Line is too long. [121/80]
Open

      if (di.block.list.first.address == di.address) && (!di.block.from_normal.nil? && (di.block.from_normal.length > 1))

Do not introduce global variables.
Open

  opt.on('-graph', '--graph', 'Output is a DOT') { $GRAPH = true }

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Do not introduce global variables.
Open

  opt.on('-print', '--print', 'Output is a DOT') { $PRINT = true }

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Move cblock += parseInstr(di) out of the conditional.
Open

        cblock += parseInstr(di)

This cop checks for identical lines at the beginning or end of each branch of a conditional statement.

Example:

# bad
if condition
  do_x
  do_z
else
  do_y
  do_z
end

# good
if condition
  do_x
else
  do_y
end
do_z

# bad
if condition
  do_z
  do_x
else
  do_z
  do_y
end

# good
do_z
if condition
  do_x
else
  do_y
end

# bad
case foo
when 1
  do_x
when 2
  do_x
else
  do_x
end

# good
case foo
when 1
  do_x
  do_y
when 2
  # nothing
else
  do_x
  do_z
end

Use == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
Open

  datas = datas.gsub(call_stub, "<a xlink:href=\"#\" stroke-width=\"0.7\" stroke=\"red\" fill=\"red\">#{call_stub.split('(')[0]}<!-- --></a>(#{call_stub.split('(')[1]}")

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

Use @glinestree.zero? instead of @glinestree == 0.
Open

    log('    [...]') if @glinestree == 0

This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Interger polymorphic.

Example: EnforcedStyle: predicate (default)

# bad

foo == 0
0 > foo
bar.baz > 0

# good

foo.zero?
foo.negative?
bar.baz.positive?

Example: EnforcedStyle: comparison

# bad

foo.zero?
foo.negative?
bar.baz.positive?

# good

foo == 0
0 > foo
bar.baz > 0

Line is too long. [271/80]
Open

    comment += ' ' + dasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce).to_s if dasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce) && !comment.include?(dasm.get_label_at(di.instruction.args.last.symbolic.target.bind.reduce).to_s)

Use snake_case for variable names.
Open

    argStr = dasm.decode_strz(di.instruction.args.last)

This cop makes sure that all variables use the configured style, snake_case or camelCase, for their names.

Example: EnforcedStyle: snake_case (default)

# bad
fooBar = 1

# good
foo_bar = 1

Example: EnforcedStyle: camelCase

# bad
foo_bar = 1

# good
fooBar = 1

Do not introduce global variables.
Open

  opt.on('-svg', '--svg', 'Output is a DOT') { $SVG = true }

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Do not introduce global variables.
Open

    return 1 if $gdasm.read_raw_data(addr, patt.length) == patt

This cops looks for uses of global variables. It does not report offenses for built-in global variables. Built-in global variables are allowed by default. Additionally users can allow additional variables via the AllowedVariables option.

Note that backreferences like $1, $2, etc are not global variables.

Example:

# bad
$foo = 2
bar = $foo + 5

# good
FOO = 2
foo = 2
$stdin.read

Line is too long. [128/80]
Open

  datas = datas.gsub(call_stub, "<a xlink:href=\"#\" stroke-width=\"0.6\" stroke=\"#c00000\" fill=\"#c00000\">#{call_stub}</a>")
Severity
Category
Status
Source
Language