crowbar/crowbar-hadoop

View on GitHub

Showing 509 of 509 total issues

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)

The name of this source file (hadoop_infrastructure-ha-journalingnode.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
Open

#

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

Do not use block comments. (https://github.com/bbatsov/ruby-style-guide#no-block-comments)
Open

=begin
to_use_disks = []
all_disks = node[:crowbar][:disks]
boot_disk=File.readlink("/dev/#{node[:crowbar_wall][:boot_device]}").split('/')[-1] rescue "sda"
if !all_disks.nil?

This cop looks for uses of block comments (=begin...=end).

Example:

# bad
=begin
Multiple lines
of comments...
=end

# good
# Multiple lines
# of comments...

The name of this source file (hadoop-secondarynamenode.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
Open

#

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

Do not use parentheses for method calls with no arguments. (https://github.com/bbatsov/ruby-style-guide#method-invocation-parens)
Open

default_attributes()
Severity: Minor
Found in chef/roles/hadoop-slavenode.rb by rubocop

This cop checks for unwanted parentheses in parameterless method calls.

Example:

# bad
object.some_method()

# good
object.some_method

Do not use parentheses for method calls with no arguments. (https://github.com/bbatsov/ruby-style-guide#method-invocation-parens)
Open

override_attributes()
Severity: Minor
Found in chef/roles/hive-interpreter.rb by rubocop

This cop checks for unwanted parentheses in parameterless method calls.

Example:

# bad
object.some_method()

# good
object.some_method

The name of this source file (pig-interpreter.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
Open

#
Severity: Minor
Found in chef/roles/pig-interpreter.rb by rubocop

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

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

      Chef::Log.warn("HI - If you want to use this disk, please erase any data on it and zero the partition information.")

The name of this source file (hadoop-masternamenode.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
Open

#
Severity: Minor
Found in chef/roles/hadoop-masternamenode.rb by rubocop

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

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

to_use_disks.sort.each { |k|

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

The name of this source file (hadoop_infrastructure-ha-filernode.rb) should use snake_case. (https://github.com/bbatsov/ruby-style-guide#snake-case-files)
Open

#

This cop makes sure that Ruby source files have snake_case names. Ruby scripts (i.e. source files with a shebang in the first line) are ignored.

Example:

# bad
lib/layoutManager.rb

anything/usingCamelCase

# good
lib/layout_manager.rb

anything/using_snake_case.rake

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

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

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 ! instead of not. (https://github.com/bbatsov/ruby-style-guide#bang-not-not)
Open

  if n[:fqdn] and not n[:fqdn].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 n[:fqdn] and not n[:fqdn].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

nfs_packages=%w{

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

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

if not File.exists?(shared_edits_directory)

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

Example:

# bad

File.exists?(some_path)

Example:

# good

File.exist?(some_path)

Useless assignment to variable - env_filter. (https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars)
Open

env_filter = " AND environment:#{node[:hadoop_infrastructure][:config][:environment]}"

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

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

lock_list=%w{

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

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

license "Apache 2.0 License, Copyright (c) 2011 Dell Inc. - http://www.apache.org/licenses/LICENSE-2.0"
Severity: Minor
Found in chef/cookbooks/pig/metadata.rb by rubocop

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

    Chef::Log.info("ZOOKEEPER : FOUND SERVER [" + rec[:ipaddress] + ", " + rec[:fqdn] + "]") if debug
Severity
Category
Status
Source
Language