hpi-schuelerklub/workshop-portal

View on GitHub

Showing 208 of 208 total issues

%i-literals should be delimited by [ and ].
Open

  enum status: %i(open accepted declined) # per database declaration, the first value is default
Severity: Minor
Found in app/models/request.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

      if participant2.agreement_letter_for_event?(self)
Severity: Minor
Found in app/models/event.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Avoid comparing a variable with multiple items in a conditional, use Array#include? instead.
Open

    order_by = 'asc' unless order_by == 'asc' || order_by == 'desc'
Severity: Minor
Found in app/models/event.rb by rubocop

This cop checks against comparing a variable with multiple items, where Array#include? could be used instead to avoid code repetition.

Example:

# bad
a = 'a'
foo if a == 'a' || a == 'b' || a == 'c'

# good
a = 'a'
foo if ['a', 'b', 'c'].include?(a)

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

    if current_user.role == 'admin' || current_user.role == 'organizer'
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

        if number_of_files != 0

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

    if @event.hidden

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

    unless params.fetch(:user, false) && params[:user].fetch(:profile, false)

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?

Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

    unless params.key?(:selected_participants)

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?
Severity
Category
Status
Source
Language