rambler-digital-solutions/Generamba

View on GitHub

Showing 840 of 840 total issues

Tab detected.
Open

        end

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

          values: parameters,
          title: "Summary for gen #{module_name}"
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

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)

Extra empty line detected at class body beginning.
Open


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

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

Trailing whitespace detected.
Open

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

Line is too long. [176/80]
Open

    method_option :custom_parameters, :type => :hash, :default => {}, :desc => 'Specifies extra parameters in format `key1:value1 key2:value2` for usage during code generation'
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

Use the new Ruby 1.9 hash syntax.
Open

    method_option :module_path, :desc => 'Specifies a location (both in the filesystem and Xcode) for new files'
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}

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

    no_commands {

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. [153/80]
Open

      properties[PROJECT_NAME_KEY] = is_right_project_name ? project_name : ask_non_empty_string('The project name:', 'Project name should not be empty')
Severity: Minor
Found in lib/generamba/cli/setup_command.rb by rubocop

Line is too long. [105/80]
Open

      @author = rambafile[AUTHOR_NAME_KEY] ? rambafile[AUTHOR_NAME_KEY] : UserPreferences.obtain_username

Line is too long. [95/80]
Open

        replace_exists_module = yes?("#{module_name} module already exists. Replace? (yes/no)")
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

Use 2 (not 1) spaces for indentation.
Open

                puts('Creating test files...')
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

Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

        unless replace_exists_module
Severity: Minor
Found in lib/generamba/cli/gen_command.rb by rubocop

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?

Line is too long. [130/80]
Open

            username = ask_non_empty_string('The author name which will be used in the headers:', 'User name should not be empty')

Tab detected.
Open

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

Tab detected.
Open

            # Saving the current changes in the Xcode project
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Unnecessary spacing detected.
Open

      properties[PROJECT_PREFIX_KEY]  = ask('The project prefix (if any):')
Severity: Minor
Found in lib/generamba/cli/setup_command.rb by rubocop

This cop checks for extra/unnecessary whitespace.

Example:

# good if AllowForAlignment is true
name      = "RuboCop"
# Some comment and an empty line

website  += "/bbatsov/rubocop" unless cond
puts        "rubocop"          if     debug

# bad for any configuration
set_app("RuboCop")
website  = "https://github.com/bbatsov/rubocop"

Tab detected.
Open

            XcodeprojHelper.clear_group(project, targets, group_path, code_module.create_logical_groups) unless processed_groups.include? group_path
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Tab detected.
Open

                # Creating the file in the filesystem
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop

Line is too long. [105/80]
Open

      project.targets.each_with_index { |element, i| targets_prompt += ("#{i}. #{element.name}" + "\n") }
Severity: Minor
Found in lib/generamba/cli/setup_command.rb by rubocop

Tab detected.
Open

                File.open(file_path, 'w+') do |f|
Severity: Minor
Found in lib/generamba/module_generator.rb by rubocop
Severity
Category
Status
Source
Language