houston/houston-core

View on GitHub
app/helpers/emoji_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage

Avoid the use of Perl-style backrefs.
Open

        "<img alt=\"#{$1}\" height=\"20\" width=\"20\" src=\"#{image_url("emoji/#{$1}.png")}\" class=\"emoji\" />"
Severity: Minor
Found in app/helpers/emoji_helper.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)

Extra empty line detected at module body end.
Open


end
Severity: Minor
Found in app/helpers/emoji_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

Favor a normal if-statement over a modifier clause in a multiline statement.
Open

    content.to_str.gsub(/:([a-z0-9\+\-_]+):/) do |match|
      if Emoji.all.map(&:name).include?($1)
        "<img alt=\"#{$1}\" height=\"20\" width=\"20\" src=\"#{image_url("emoji/#{$1}.png")}\" class=\"emoji\" />"
      else
        match
Severity: Minor
Found in app/helpers/emoji_helper.rb by rubocop

Checks for uses of if/unless modifiers with multiple-lines bodies.

Example:

# bad
{
  result: 'this should not happen'
} unless cond

# good
{ result: 'ok' } if cond

Missing top-level module documentation comment.
Open

module EmojiHelper
Severity: Minor
Found in app/helpers/emoji_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

Avoid the use of Perl-style backrefs.
Open

        "<img alt=\"#{$1}\" height=\"20\" width=\"20\" src=\"#{image_url("emoji/#{$1}.png")}\" class=\"emoji\" />"
Severity: Minor
Found in app/helpers/emoji_helper.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)

Extra empty line detected at module body beginning.
Open


  def emojify(content)
Severity: Minor
Found in app/helpers/emoji_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

Avoid the use of Perl-style backrefs.
Open

      if Emoji.all.map(&:name).include?($1)
Severity: Minor
Found in app/helpers/emoji_helper.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)

Line is too long. [114/80]
Open

        "<img alt=\"#{$1}\" height=\"20\" width=\"20\" src=\"#{image_url("emoji/#{$1}.png")}\" class=\"emoji\" />"
Severity: Minor
Found in app/helpers/emoji_helper.rb by rubocop

There are no issues that match your filters.

Category
Status