crowbar/crowbar-hadoop

View on GitHub

Showing 509 of 509 total issues

Line is too long. [105/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

    servernodes       = nodeswithroles.find_all { |n| n.roles.include?("hadoop_infrastructure-server" ) }

Use ! instead of not. (https://github.com/bbatsov/ruby-style-guide#bang-not-not)
Open

    if not namenodes.empty?

This cop checks for uses of the keyword not instead of !.

Example:

# bad - parentheses are required because of op precedence
x = (not something)

# good
x = !something

Use ! instead of not. (https://github.com/bbatsov/ruby-style-guide#bang-not-not)
Open

    if not datanodes.empty?

This cop checks for uses of the keyword not instead of !.

Example:

# bad - parentheses are required because of op precedence
x = (not something)

# good
x = !something

Use !empty? instead of length > 0.
Open

    if edge_fqdns && edge_fqdns.length > 0

This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

Example:

# bad
[1, 2, 3].length == 0
0 == "foobar".length
array.length < 1
{a: 1, b: 2}.length != 0
string.length > 0
hash.size > 0

# good
[1, 2, 3].empty?
"foobar".empty?
array.empty?
!{a: 1, b: 2}.empty?
!string.empty?
!hash.empty?

Avoid using {...} for multi-line blocks. (https://github.com/bbatsov/ruby-style-guide#single-line-blocks)
Open

    edge_nodes.each { |x|

Check for uses of braces or do/end around single line or multi-line blocks.

Example: EnforcedStyle: linecountbased (default)

# bad - single line block
items.each do |item| item / 5 end

# good - single line block
items.each { |item| item / 5 }

# bad - multi-line block
things.map { |thing|
  something = thing.some_method
  process(something)
}

# good - multi-line block
things.map do |thing|
  something = thing.some_method
  process(something)
end

Example: EnforcedStyle: semantic

# Prefer `do...end` over `{...}` for procedural blocks.

# return value is used/assigned
# bad
foo = map do |x|
  x
end
puts (map do |x|
  x
end)

# return value is not used out of scope
# good
map do |x|
  x
end

# Prefer `{...}` over `do...end` for functional blocks.

# return value is not used out of scope
# bad
each { |x|
  x
}

# return value is used/assigned
# good
foo = map { |x|
  x
}
map { |x|
  x
}.inspect

Example: EnforcedStyle: bracesforchaining

# bad
words.each do |word|
  word.flip.flop
end.join("-")

# good
words.each { |word|
  word.flip.flop
}.join("-")

Space missing after comma. (https://github.com/bbatsov/ruby-style-guide#spaces-operators)
Open

  node[:hadoop][:mapred][:mapred_local_dir] << ::File.join(disk[:mount_point],"mapred")

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

Example:

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

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

Surrounding space missing for operator =. (https://github.com/bbatsov/ruby-style-guide#spaces-operators)
Open

  target_suffix= k + "1"

Checks that operators have space around them, except for ** which should not have surrounding space.

Example:

# bad
total = 3*4
"apple"+"juice"
my_number = 38/4
a ** b

# good
total = 3 * 4
"apple" + "juice"
my_number = 38 / 4
a**b

Avoid using {...} for multi-line blocks. (https://github.com/bbatsov/ruby-style-guide#single-line-blocks)
Open

all_disks.each { |k,v|

Check for uses of braces or do/end around single line or multi-line blocks.

Example: EnforcedStyle: linecountbased (default)

# bad - single line block
items.each do |item| item / 5 end

# good - single line block
items.each { |item| item / 5 }

# bad - multi-line block
things.map { |thing|
  something = thing.some_method
  process(something)
}

# good - multi-line block
things.map do |thing|
  something = thing.some_method
  process(something)
end

Example: EnforcedStyle: semantic

# Prefer `do...end` over `{...}` for procedural blocks.

# return value is used/assigned
# bad
foo = map do |x|
  x
end
puts (map do |x|
  x
end)

# return value is not used out of scope
# good
map do |x|
  x
end

# Prefer `{...}` over `do...end` for functional blocks.

# return value is not used out of scope
# bad
each { |x|
  x
}

# return value is used/assigned
# good
foo = map { |x|
  x
}
map { |x|
  x
}.inspect

Example: EnforcedStyle: bracesforchaining

# bad
words.each do |word|
  word.flip.flop
end.join("-")

# good
words.each { |word|
  word.flip.flop
}.join("-")

File.exists? is deprecated in favor of File.exist?.
Open

  if (!File.exists?("#{hb}/meta1/current/VERSION"))

This cop checks for uses of the deprecated class method usages.

Example:

# bad

File.exists?(some_path)

Example:

# good

File.exist?(some_path)

Line is too long. [106/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

  Chef::Log.info("HADOOP : EDGE_NODES           {" + node[:hadoop][:cluster][:edge_nodes].join(",") + "}")

Line is too long. [105/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

# Create mapred_local_dir and set ownership/permissions (/var/lib/hadoop-0.20/cache/mapred/mapred/local).

Space inside range literal. (https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals)
Open

      nodes[3 .. nodes.size].each { |n|

Checks for spaces inside range literals.

Example:

# bad
1 .. 3

# good
1..3

# bad
'a' .. 'z'

# good
'a'..'z'

Line is too long. [107/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

    edgenodes         = nodeswithroles.find_all { |n| n.roles.include?("hadoop_infrastructure-edgenode" ) }

Use ! instead of not. (https://github.com/bbatsov/ruby-style-guide#bang-not-not)
Open

    if not servernodes.empty?

This cop checks for uses of the keyword not instead of !.

Example:

# bad - parentheses are required because of op precedence
x = (not something)

# good
x = !something

Redundant return detected. (https://github.com/bbatsov/ruby-style-guide#no-explicit-return)
Open

    return @hadoop_config

This cop checks for redundant return expressions.

Example:

def test
  return something
end

def test
  one
  two
  three
  return something
end

It should be extended to handle methods whose body is if/else or a case expression with a default branch.

Space inside parentheses detected. (https://github.com/bbatsov/ruby-style-guide#spaces-braces)
Open

    hajournalingnodes = nodeswithroles.find_all { |n| n.roles.include?("hadoop_infrastructure-ha-journalingnode" ) }

Checks for spaces inside ordinary round parentheses.

Example:

# bad
f( 3)
g = (a + 3 )

# good
f(3)
g = (a + 3)

Line is too long. [116/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

    hajournalingnodes = nodeswithroles.find_all { |n| n.roles.include?("hadoop_infrastructure-ha-journalingnode" ) }

Use ! instead of not. (https://github.com/bbatsov/ruby-style-guide#bang-not-not)
Open

    if not hafilernodes.empty?

This cop checks for uses of the keyword not instead of !.

Example:

# bad - parentheses are required because of op precedence
x = (not something)

# good
x = !something

Line is too long. [103/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

    edge_nodes = nodes.find_all { |n| n.role? "hadoop-edgenode" or n.role? "clouderamanager-edgenode" }

Line is too long. [175/100] (https://github.com/SUSE/style-guides/blob/master/Ruby.md#metricslinelength)
Open

default[:hadoop][:core][:io_compression_codecs] = "org.apache.hadoop.io.compress.DefaultCodec,org.apache.hadoop.io.compress.GzipCodec,org.apache.hadoop.io.compress.BZip2Codec"
Severity
Category
Status
Source
Language