crowbar/crowbar-hadoop

View on GitHub

Showing 509 of 509 total issues

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

    base["deployment"]["hadoop"]["elements"]["hadoop-masternamenode"] = master if master && !master.empty?

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

edge_nodes = 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 = ''

Use hash literal {} instead of Hash.new. (https://github.com/bbatsov/ruby-style-guide#literal-array-hash)
Open

  disk = Hash.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 = ''

Do not prefix reader method names with get_. (https://github.com/bbatsov/ruby-style-guide#accessor_mutator_method_names)
Open

  def get_hadoop_config

This cop makes sure that accessor methods are named properly.

Example:

# bad
def set_attribute(value)
end

# good
def attribute=(value)
end

# bad
def get_attribute
end

# good
def attribute
end

Use meaningful heredoc delimiters. (https://github.com/bbatsov/ruby-style-guide#heredoc-delimiters)
Open

EOH

This cop checks that your heredocs are using meaningful delimiters. By default it disallows END and EO*, and can be configured through blacklisting additional delimiters.

Example:

# good
<<-SQL
  SELECT * FROM foo
SQL

# bad
<<-END
  SELECT * FROM foo
END

# bad
<<-EOS
  SELECT * FROM foo
EOS

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

    if not edgenodes.empty?
      base["deployment"]["hadoop_infrastructure"]["elements"]["hadoop_infrastructure-edgenode"] = edgenodes
    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

Prefer !expression.nil? over expression != nil. (https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks)
Open

    nodeswithroles    = NodeObject.all.find_all { |n| n.roles != nil }

This cop checks for non-nil checks, which are usually redundant.

Example:

# bad
if x != nil
end

# good (when not allowing semantic changes)
# bad (when allowing semantic changes)
if !x.nil?
end

# good (when allowing semantic changes)
if x
end

Non-nil checks are allowed if they are the final nodes of predicate.

# good
def signed_in?
  !current_user.nil?
end

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

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

Use master_name_nodes.length.zero? instead of master_name_nodes.length == 0. (https://github.com/bbatsov/ruby-style-guide#predicate-methods)
Open

if master_name_nodes.length == 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

Avoid using rescue in its modifier form. (https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers)
Open

    keys[nedge.name] = nedge["crowbar"]["ssh"]["root_pub_key"] rescue nil

This cop checks for uses of rescue in its modifier form.

Example:

# bad
some_method rescue handle_error

# good
begin
  some_method
rescue
  handle_error
end

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

    base["deployment"]["pig"]["elements"] = { }

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

Use !empty? instead of length > 0.
Open

if !secondary_name_node_objects.nil? && secondary_name_node_objects.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

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

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

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

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

    edge_fqdns = 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 = ''

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

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

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

      base["deployment"]["hadoop_infrastructure"]["elements"]["hadoop_infrastructure-cb-adminnode"] = adminnodes

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

  secondary_node_ip = BarclampLibrary::Barclamp::Inventory.get_network_by_type(secondary_name_node_objects[0],"admin").address

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

      base["deployment"]["hadoop_infrastructure"]["elements"]["hadoop_infrastructure-edgenode"] = edgenodes

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

      base["deployment"]["hadoop_infrastructure"]["elements"]["hadoop_infrastructure-datanode"] = datanodes
Severity
Category
Status
Source
Language