carmentang/engineerswithoutborders

View on GitHub
features/support/paths.rb

Summary

Maintainability
A
0 mins
Test Coverage

Method has too many lines. [19/10]
Open

  def path_to(page_name)
    case page_name

    when /^the home\s?page$/
       '/'
Severity: Minor
Found in features/support/paths.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Trailing whitespace detected.
Open

       
Severity: Minor
Found in features/support/paths.rb by rubocop

Use 2 (not 3) spaces for indentation.
Open

       '/volunteers'
Severity: Minor
Found in features/support/paths.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

Align the operands of an expression spanning multiple lines.
Open

          "Now, go and add a mapping in #{__FILE__}"
Severity: Minor
Found in features/support/paths.rb by rubocop

This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

Example:

# bad
if a +
b
  something
end

# good
if a +
   b
  something
end

Trailing whitespace detected.
Open

    
Severity: Minor
Found in features/support/paths.rb by rubocop

Use 2 (not 3) spaces for indentation.
Open

       '/volunteers/new'
Severity: Minor
Found in features/support/paths.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

Avoid the use of Perl-style backrefs.
Open

        path_components = $1.split(/\s+/)
Severity: Minor
Found in features/support/paths.rb by rubocop

This cop looks for uses of Perl-style regexp match backreferences like $1, $2, etc.

Example:

# bad
puts $1

# good
puts Regexp.last_match(1)

Use 2 (not 3) spaces for indentation.
Open

       '/'
Severity: Minor
Found in features/support/paths.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 \ instead of + or << to concatenate those strings.
Open

        raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
Severity: Minor
Found in features/support/paths.rb by rubocop

This cop checks for string literal concatenation at the end of a line.

Example:

# bad
some_str = 'ala' +
           'bala'

some_str = 'ala' <<
           'bala'

# good
some_str = 'ala' \
           'bala'

Redundant self detected.
Open

        self.send(path_components.push('path').join('_').to_sym)
Severity: Minor
Found in features/support/paths.rb by rubocop

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

There are no issues that match your filters.

Category
Status