xiaohui-zhangxh/editor_js

View on GitHub

Showing 104 of 110 total issues

Add parentheses to nested method call Sanitize.fragment data['text'].
Open

        decode_html(Sanitize.fragment data['text']).strip

This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.

Example:

# good
method1(method2(arg), method3(arg))

# bad
method1(method2 arg, method3, arg)

Redundant self detected.
Open

        @type ||= self.to_s.underscore.split('/').last.gsub('_block', '')
Severity: Minor
Found in lib/editor_js/blocks/base.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

Line is too long. [82/80]
Open

          html_class += " #{css_name}__picture--with-background" if withBackground
Severity: Minor
Found in lib/editor_js/blocks/image_block.rb by rubocop

Line is too long. [148/80]
Open

          html = '<div class="highlighter-rouge language-' + CGI.escapeHTML(node.fence_info) + '">' + formatter.format(lexer.lex(source)) + '</div>'
Severity: Minor
Found in lib/common_marker/rouge.rb by rubocop
Severity
Category
Status
Source
Language