Xiaohong-Deng/mooqita-icccg

View on GitHub
app/jobs/answer_broadcast_job.rb

Summary

Maintainability
A
0 mins
Test Coverage

Missing top-level class documentation comment.
Open

class AnswerBroadcastJob < ApplicationJob
Severity: Minor
Found in app/jobs/answer_broadcast_job.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

Missing magic comment # frozen_string_literal: true.
Open

class AnswerBroadcastJob < ApplicationJob
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: when_needed (default)

# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
  # ...
end

# good
# frozen_string_literal: true

module Foo
  # ...
end

Example: EnforcedStyle: always

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

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

    ActionCable.server.broadcast "game-#{answer.question.game_id}: answers", { message: answer_submitted, message_type: "answer" }
Severity: Minor
Found in app/jobs/answer_broadcast_job.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"

Inconsistent indentation detected.
Open

    def answer_submitted
      "<div class='answer_content'>One answer has been submitted.</div>"
    end
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end

Keep a blank line before and after private.
Open

  private
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

Access modifiers should be surrounded by blank lines.

Example:

# bad
class Foo
  def bar; end
  private
  def baz; end
end

# good
class Foo
  def bar; end

  private

  def baz; end
end

Line is too long. [130/80]
Open

    ActionCable.server.broadcast "game-#{answer.question.game_id}: answers", { message: answer_submitted, message_type: "answer" }
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

Line is too long. [100/80]
Open

      # ApplicationController.renderer.render(partial: 'answers/answer', locals: { answer: answer })
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

Redundant curly braces around a hash parameter.
Open

    ActionCable.server.broadcast "game-#{answer.question.game_id}: answers", { message: answer_submitted, message_type: "answer" }
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Incorrect indentation detected (column 4 instead of 6).
Open

    # def render_message(answer)
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

This cops checks the indentation of comments.

Example:

# bad
  # comment here
def method_name
end

  # comment here
a = 'hello'

# yet another comment
  if true
    true
  end

# good
# comment here
def method_name
end

# comment here
a = 'hello'

# yet another comment
if true
  true
end

Incorrect indentation detected (column 6 instead of 4).
Open

      # ApplicationController.renderer.render(partial: 'answers/answer', locals: { answer: answer })
Severity: Minor
Found in app/jobs/answer_broadcast_job.rb by rubocop

This cops checks the indentation of comments.

Example:

# bad
  # comment here
def method_name
end

  # comment here
a = 'hello'

# yet another comment
  if true
    true
  end

# good
# comment here
def method_name
end

# comment here
a = 'hello'

# yet another comment
if true
  true
end

There are no issues that match your filters.

Category
Status