rambler-digital-solutions/Generamba

View on GitHub

Showing 840 of 840 total issues

Tab detected.
Open

                                                                code_module,
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Tab detected.
Open

            puts "Project file path: #{code_module.project_file_path}".green if code_module.project_file_path
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Tab detected.
Open

            puts "Test file path: #{code_module.test_file_path}".green if code_module.test_file_path
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Redundant self detected.
Open

        if file_is_resource || self.is_bundle_resource?(file_name)

This cop checks for redundant uses of self.

The usage of self is only needed when:

  • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

  • Calling an attribute writer to prevent an local variable assignment.

Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

Note we allow uses of self with operators because it would be awkward otherwise.

Example:

# bad
def foo(bar)
  self.baz
end

# good
def foo(bar)
  self.bar  # Resolves name clash with the argument.
end

def foo
  bar = 1
  self.bar  # Resolves name clash with the local variable.
end

def foo
  %w[x y z].select do |bar|
    self.bar == bar  # Resolves name clash with argument of the block.
  end
end

Tab detected.
Open

        end
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Prefer the use of the nil? predicate.
Open

            if targets.count == 0 || files == nil || files.count == 0 || dir_path == nil || group_path == nil
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

This cop checks for comparison of something with nil using ==.

Example:

# bad
if x == nil
end

# good
if x.nil?
end

Indent the first parameter one step more than the start of the previous line.
Open

          values: properties,
          title: "Summary for template create"

This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

Example:

# bad
some_method(
first_param,
second_param)

# good
some_method(
  first_param,
second_param)

Do not use unless with else. Rewrite these with the positive case first.
Open

      unless options
        spec = YAML.load_file(spec_path)
      else
        spec_source = IO.read(spec_path)
        spec_template = Liquid::Template.parse(spec_source)

This cop looks for unless expressions with else clauses.

Example:

# bad
unless foo_bar.nil?
  # do something...
else
  # do a different thing...
end

# good
if foo_bar.present?
  # do something...
else
  # do a different thing...
end

Line is too long. [93/80]
Open

        templates += catalog_template_search_helper.search_templates_in_a_catalog(path, term)

Freeze mutable objects assigned to constants.
Open

  PATH_TYPE_TEST = 'test'

This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

Example:

# bad
CONST = [1, 2, 3]

# good
CONST = [1, 2, 3].freeze

Line is too long. [102/80]
Open

    desc 'install', 'Installs all the templates specified in the Rambafile from the current directory'

Extra empty line detected at class body beginning.
Open


  end

This cops checks if empty lines around the bodies of classes match the configuration.

Example: EnforcedStyle: empty_lines

# good

class Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

class Foo
  class Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
class Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

class Foo
  def bar
    # ...
  end
end

Avoid using {...} for multi-line blocks.
Open

      File.open(RAMBAFILE_NAME, 'w+') {|f|

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

Line is too long. [84/80]
Open

    method_option :author, :desc => 'Specifies the author name for generated module'
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

Inconsistent indentation detected.
Open

                FileUtils.mkdir_p File.dirname(file_path) if !code_module.create_logical_groups
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Line is too long. [119/80]
Open

      DependencyChecker.check_all_required_dependencies_has_in_podfile(template.dependencies, code_module.podfile_path)
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

Use 2 (not 1) spaces for indentation.
Open

                    f.write(file_content)
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Use nested module/class definitions instead of compact style.
Open

module Generamba::CLI
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

Example: EnforcedStyle: nested (default)

# good
# have each child on its own line
class Foo
  class Bar
  end
end

Example: EnforcedStyle: compact

# good
# combine definitions as much as possible
class Foo::Bar
end

The compact style is only forced for classes/modules with one child.

Tab detected.
Open

    class ModuleGenerator
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

    method_option :author, :desc => 'Specifies the author name for generated module'
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

This cop checks hash literal syntax.

It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

A separate offense is registered for each problematic pair.

The supported styles are:

  • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
  • hash_rockets - forces use of hash rockets for all hashes
  • nomixedkeys - simply checks for hashes with mixed syntaxes
  • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

Example: EnforcedStyle: ruby19 (default)

# bad
{:a => 2}
{b: 1, :c => 2}

# good
{a: 2, b: 1}
{:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
{d: 1, 'e' => 2} # technically not forbidden

Example: EnforcedStyle: hash_rockets

# bad
{a: 1, b: 2}
{c: 1, 'd' => 5}

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

Example: EnforcedStyle: nomixedkeys

# bad
{:a => 1, b: 2}
{c: 1, 'd' => 2}

# good
{:a => 1, :b => 2}
{c: 1, d: 2}

Example: EnforcedStyle: ruby19nomixed_keys

# bad
{:a => 1, :b => 2}
{c: 2, 'd' => 3} # should just use hash rockets

# good
{a: 1, b: 2}
{:c => 3, 'd' => 4}
Severity
Category
Status
Source
Language