houston/houston-core

View on GitHub
app/helpers/avatar_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage

Extra blank line detected.
Open


  # http://en.gravatar.com/site/implement/ruby
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Extra blank line detected.
Open


end
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Do not use :: for method calls.
Open

    url = "https://www.gravatar.com/avatar/#{Digest::MD5::hexdigest(email)}?r=g&d=retro"
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cop checks for methods invoked via the :: operator instead of the . operator (like FileUtils::rmdir instead of FileUtils.rmdir).

Example:

# bad
Timeout::timeout(500) { do_something }
FileUtils::rmdir(dir)
Marshal::dump(obj)

# good
Timeout.timeout(500) { do_something }
FileUtils.rmdir(dir)
Marshal.dump(obj)

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

    return "" if email.blank?
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [120/80]
Open

    return "<div class=\"avatar avatar-empty\" style=\"width:#{size}px; height:#{size}px\"></div>".html_safe unless user
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Line is too long. [88/80]
Open

    url = "https://www.gravatar.com/avatar/#{Digest::MD5::hexdigest(email)}?r=g&d=retro"
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Use empty lines between method definitions.
Open

  def gravatar_url(email, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Surrounding space missing in default value assignment.
Open

  def gravatar_image(email, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

Surrounding space missing in default value assignment.
Open

  def avatar_for(user, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

Surrounding space missing in default value assignment.
Open

  def gravatar_url(email, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

Example:

# bad
def some_method(arg1=:default, arg2=nil, arg3=[])
  # do something...
end

# good
def some_method(arg1 = :default, arg2 = nil, arg3 = [])
  # do something...
end

Extra empty line detected at module body end.
Open


end
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

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

Example: EnforcedStyle: empty_lines

# good

module Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

module Foo
  module Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
module Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

module Foo
  def bar
    # ...
  end
end

Missing top-level module documentation comment.
Open

module AvatarHelper
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Use empty lines between method definitions.
Open

  def gravatar_image(email, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cop checks whether method definitions are separated by one empty line.

NumberOfEmptyLines can be and integer (e.g. 1 by default) or an array (e.g. [1, 2]) to specificy a minimum and a maximum of empty lines.

AllowAdjacentOneLineDefs can be used to configure is adjacent one line methods definitions are an offense

Example:

# bad
def a
end
def b
end

Example:

# good
def a
end

def b
end

Extra empty line detected at module body beginning.
Open



Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

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

Example: EnforcedStyle: empty_lines

# good

module Foo

  def bar
    # ...
  end

end

Example: EnforcedStyle: emptylinesexcept_namespace

# good

module Foo
  module Bar

    # ...

  end
end

Example: EnforcedStyle: emptylinesspecial

# good
module Foo

  def bar; end

end

Example: EnforcedStyle: noemptylines (default)

# good

module Foo
  def bar
    # ...
  end
end

Line is too long. [139/80]
Open

    "<img class=\"avatar\" src=\"#{gravatar_url(email, size: size * 2)}\" width=\"#{size}\" height=\"#{size}\" alt=\"#{alt}\" />".html_safe
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Extra blank line detected.
Open


  def avatar_for(user, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Extra blank line detected.
Open



Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Line is too long. [166/80]
Open

    "<img class=\"avatar user-#{user.id}\" src=\"#{gravatar_url(user.email, size: size * 2)}\" width=\"#{size}\" height=\"#{size}\" alt=\"#{user.name}\" />".html_safe
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

Extra blank line detected.
Open


  def gravatar_image(email, options={})
Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

Extra blank line detected.
Open



Severity: Minor
Found in app/helpers/avatar_helper.rb by rubocop

This cops checks for two or more consecutive blank lines.

Example:

# bad - It has two empty lines.
some_method
# one empty line
# two empty lines
some_method

# good
some_method
# one empty line
some_method

There are no issues that match your filters.

Category
Status