jbox-web/ajax-datatables-rails

View on GitHub

Showing 1 of 2 total issues

Convert if nested inside else to elsif.
Open

        if opts['version'].empty?
Severity: Minor
Found in Appraisals by rubocop

If the else branch of a conditional consists solely of an if node, it can be combined with the else to become an elsif. This helps to keep the nesting level from getting too deep.

Example:

# bad
if condition_a
  action_a
else
  if condition_b
    action_b
  else
    action_c
  end
end

# good
if condition_a
  action_a
elsif condition_b
  action_b
else
  action_c
end

Example: AllowIfModifier: false (default)

# bad
if condition_a
  action_a
else
  action_b if condition_b
end

# good
if condition_a
  action_a
elsif condition_b
  action_b
end

Example: AllowIfModifier: true

# good
if condition_a
  action_a
else
  action_b if condition_b
end

# good
if condition_a
  action_a
elsif condition_b
  action_b
end
Severity
Category
Status
Source
Language