crowbar/crowbar-hadoop

View on GitHub

Showing 509 of 509 total issues

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

description "Common libraries and utilities that provides the basic Hadoop runtime environment (HDFS/Map Reduce). A set of components and interfaces which implements a distributed filesystem and provides general I/O access for the hadoop framework (serialization, Java RPC and persistent data storage)."
Severity: Minor
Found in chef/cookbooks/hadoop/metadata.rb by rubocop

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

recipe "hadoop::edgenode", "Installs the edge node and task tracker packages and prepares the file system."
Severity: Minor
Found in chef/cookbooks/hadoop/metadata.rb by rubocop

Do not leave space between ! and its argument. (https://github.com/bbatsov/ruby-style-guide#no-space-bang)
Open

  if ! File.exists?(target_dev)

This cop checks for space after !.

Example:

# bad
! something

# good
!something

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

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

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

      base["deployment"]["hadoop_infrastructure"]["elements"]["hadoop_infrastructure-ha-journalingnode"] = hajournalingnodes

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

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

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("-")

Favor unless over if for negative conditions. (https://github.com/bbatsov/ruby-style-guide#unless-for-negatives)
Open

    if not adminnodes.empty?
      base["deployment"]["hadoop_infrastructure"]["elements"]["hadoop_infrastructure-cb-adminnode"] = adminnodes
    end

Checks for uses of if with a negated condition. Only ifs without else are considered. There are three different styles:

- both
- prefix
- postfix

Example: EnforcedStyle: both (default)

# enforces `unless` for `prefix` and `postfix` conditionals

# bad

if !foo
  bar
end

# good

unless foo
  bar
end

# bad

bar if !foo

# good

bar unless foo

Example: EnforcedStyle: prefix

# enforces `unless` for just `prefix` conditionals

# bad

if !foo
  bar
end

# good

unless foo
  bar
end

# good

bar if !foo

Example: EnforcedStyle: postfix

# enforces `unless` for just `postfix` conditionals

# bad

bar if !foo

# good

bar unless foo

# good

if !foo
  bar
end

Use || instead of or. (https://github.com/bbatsov/ruby-style-guide#no-and-or-or)
Open

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

This cop checks for uses of and and or, and suggests using && and || instead. It can be configured to check only in conditions, or in all contexts.

Example: EnforcedStyle: always (default)

# bad
foo.save and return

# bad
if foo and bar
end

# good
foo.save && return

# good
if foo && bar
end

Example: EnforcedStyle: conditionals

# bad
if foo and bar
end

# good
foo.save && return

# good
foo.save and return

# good
if foo && bar
end

Use 2 spaces for indentation in a heredoc by using some library(e.g. ActiveSupport's String#strip_heredoc). (https://github.com/bbatsov/ruby-style-guide#squiggly-heredocs)
Open

echo 'Y' | hadoop namenode -format
EOH

This cops checks the indentation of the here document bodies. The bodies are indented one step. In Ruby 2.3 or newer, squiggly heredocs (<<~) should be used. If you use the older rubies, you should introduce some library to your project (e.g. ActiveSupport, Powerpack or Unindent). Note: When Metrics/LineLength's AllowHeredoc is false(not default), this cop does not add any offenses for long here documents to avoid Metrics/LineLength's offenses.

Example:

# bad
<<-RUBY
something
RUBY

# good
# When EnforcedStyle is squiggly, bad code is auto-corrected to the
# following code.
<<~RUBY
  something
RUBY

# good
# When EnforcedStyle is active_support, bad code is auto-corrected to
# the following code.
<<-RUBY.strip_heredoc
  something
RUBY

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

default[:hadoop][:core][:topology_node_switch_mapping_impl] = "org.apache.hadoop.net.ScriptBasedMapping"

Use array literal [] instead of Array.new. (https://github.com/bbatsov/ruby-style-guide#literal-array-hash)
Open

secondary_name_node_objects = Array.new

This cop checks for the use of a method, the result of which would be a literal, like an empty array, hash or string.

Example:

# bad
a = Array.new
h = Hash.new
s = String.new

# good
a = []
h = {}
s = ''

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

  node[:hadoop][:hdfs][:dfs_data_dir] << ::File.join(disk[:mount_point],"data")

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

    disk[:uuid]=get_uuid target_dev_part

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

Use empty? instead of length == 0.
Open

if master_name_nodes.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?

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

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

Checks for spaces inside ordinary round parentheses.

Example:

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

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

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

    disk[:mount_point]="#{dfs_base_dir}/hdfs01/#{disk[:uuid]}"

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

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||. (https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier)
Open

        if n[:fqdn] and !n[:fqdn].empty?

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

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

    unless ::File.exists?(disk[:mount_point]) and ::File.directory?(disk[:mount_point])

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

Example:

# bad

File.exists?(some_path)

Example:

# good

File.exist?(some_path)

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

    if not hajournalingnodes.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

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

  uuid=nil

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
Severity
Category
Status
Source
Language