Xiaohong-Deng/mooqita-icccg

View on GitHub

Showing 316 of 316 total issues

Line is too long. [108/80]
Open

    ActionCable.server.broadcast "game-#{question.game_id}: questions", { message: render_message(question),
Severity: Minor
Found in app/jobs/question_broadcast_job.rb by rubocop

Space inside } missing.
Open

      template: render('waiting', {participants_size: GameWaitingRoom.participants_size})
Severity: Minor
Found in app/jobs/concerns/templatable.rb by rubocop

Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

Example: EnforcedStyle: space

# The `space` style enforces that hash literals have
# surrounding space.

# bad
h = {a: 1, b: 2}

# good
h = { a: 1, b: 2 }

Example: EnforcedStyle: no_space

# The `no_space` style enforces that hash literals have
# no surrounding space.

# bad
h = { a: 1, b: 2 }

# good
h = {a: 1, b: 2}

Example: EnforcedStyle: compact

# The `compact` style normally requires a space inside
# hash braces, with the exception that successive left
# braces or right braces are collapsed together in nested hashes.

# bad
h = { a: { b: 2 } }

# good
h = { a: { b: 2 }}

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

      game.game_players.exclude_role("judge").shuffle[0]
Severity: Minor
Found in app/models/game.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. [106/80]
Open

      ApplicationController.renderer.render(partial: 'questions/question', locals: { question: question })
Severity: Minor
Found in app/jobs/question_broadcast_job.rb by rubocop

Line is too long. [99/80]
Open

  validates :question_id, uniqueness: { scope: :judge_choice }, if: Proc.new { |a| a.judge_choice }
Severity: Minor
Found in app/models/answer.rb by rubocop

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

      message_type: "question", round: question.round }
Severity: Minor
Found in app/jobs/question_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"

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

Keep a blank line before and after private.
Open

  private

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. [100/80]
Open

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

Inconsistent indentation detected.
Open

    def next_questioner
      game_players.exclude_role("judge").shuffle[0]
    end
Severity: Minor
Found in app/models/game.rb by rubocop

This cops checks for inconsistent indentation.

Example:

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

Use sample instead of shuffle[0].
Open

      game.game_players.exclude_role("judge").shuffle[0]
Severity: Minor
Found in app/models/game.rb by rubocop

This cop is used to identify usages of shuffle.first, shuffle.last and shuffle[] and change them to use sample instead.

Example:

# bad
[1, 2, 3].shuffle.first
[1, 2, 3].shuffle.first(2)
[1, 2, 3].shuffle.last
[1, 2, 3].shuffle[2]
[1, 2, 3].shuffle[0, 2]    # sample(2) will do the same
[1, 2, 3].shuffle[0..2]    # sample(3) will do the same
[1, 2, 3].shuffle(random: Random.new).first

# good
[1, 2, 3].shuffle
[1, 2, 3].sample
[1, 2, 3].sample(3)
[1, 2, 3].shuffle[1, 3]    # sample(3) might return a longer Array
[1, 2, 3].shuffle[1..3]    # sample(3) might return a longer Array
[1, 2, 3].shuffle[foo, bar]
[1, 2, 3].shuffle(random: Random.new)

Missing top-level class documentation comment.
Open

class Game < ApplicationRecord
Severity: Minor
Found in app/models/game.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

Line is too long. [94/80]
Open

  # if an entry to be updated has judge_choice = true, will check if there is already an entry
Severity: Minor
Found in app/models/answer.rb by rubocop

Rename has_judge_choice? to judge_choice?.
Open

  def has_judge_choice?
Severity: Minor
Found in app/models/question.rb by rubocop

This cop makes sure that predicates are named properly.

Example:

# bad
def is_even?(value)
end

# good
def even?(value)
end

# bad
def has_value?
end

# good
def value?
end

Missing top-level class documentation comment.
Open

class Question < ApplicationRecord
Severity: Minor
Found in app/models/question.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 == if you meant to do a comparison or wrap the expression in parentheses to indicate you meant to assign in a condition.
Open

      if question = @game.questions.find_by(round: round)
Severity: Minor
Found in app/channels/game_channel.rb by rubocop

This cop checks for assignments in the conditions of if/while/until.

Example:

# bad

if some_var = true
  do_something
end

Example:

# good

if some_var == true
  do_something
end

Missing top-level module documentation comment.
Open

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

Line is too long. [135/80]
Open

      ActionCable.server.broadcast "game-#{@answer.question.game_id}: info", { message: "Judge made his choice", message_type: "info" }

Keep a blank line before and after private.
Open

  private
Severity: Minor
Found in app/controllers/games_controller.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

Inconsistent indentation detected.
Open

    def set_game
      @game = Game.find(params[:id])
    rescue ActiveRecord::RecordNotFound
      flash[:alert] = "The game you were looking for could not be found."
      redirect_to root_path
Severity: Minor
Found in app/controllers/games_controller.rb by rubocop

This cops checks for inconsistent indentation.

Example:

class A
  def test
    puts 'hello'
     puts 'world'
  end
end
Severity
Category
Status
Source
Language