MidnightRiders/MemberPortal

View on GitHub
app/helpers/application_helper.rb

Summary

Maintainability
A
0 mins
Test Coverage

Do not use instance variables in helpers.
Open

    @javascript_files = ((@javascript_files || []) + [files]).flatten.uniq
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Do not use instance variables in helpers.
Open

    javascript_include_tag *@javascript_files if @javascript_files
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Do not use instance variables in helpers.
Open

    @javascript_files = ((@javascript_files || []) + [files]).flatten.uniq
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Do not use instance variables in helpers.
Open

    javascript_include_tag *@javascript_files if @javascript_files
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Ambiguous splat operator. Parenthesize the method arguments if it's surely a splat operator, or add a whitespace to the right of the * if it should be a multiplication. (https://rubystyle.guide#method-invocation-parens)
Open

    javascript_include_tag *@javascript_files if @javascript_files
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Checks for ambiguous operators in the first argument of a method invocation without parentheses.

Example:

# bad

# The `*` is interpreted as a splat operator but it could possibly be
# a `*` method invocation (i.e. `do_something.*(some_array)`).
do_something *some_array

Example:

# good

# With parentheses, there's no ambiguity.
do_something(*some_array)

Use a guard clause (return unless object.errors[method].any?) instead of wrapping the code inside a conditional expression. (https://rubystyle.guide#no-nested-conditionals)
Open

    if object.errors[method].any?
Severity: Minor
Found in app/helpers/application_helper.rb by rubocop

Use a guard clause instead of wrapping the code inside a conditional expression

A condition with an elsif or else branch is allowed unless one of return, break, next, raise, or fail is used in the body of the conditional expression.

NOTE: Autocorrect works in most cases except with if-else statements that contain logical operators such as foo || raise('exception')

Example:

# bad
def test
  if something
    work
  end
end

# good
def test
  return unless something

  work
end

# also good
def test
  work if something
end

# bad
if something
  raise 'exception'
else
  ok
end

# good
raise 'exception' if something
ok

# bad
if something
  foo || raise('exception')
else
  ok
end

# good
foo || raise('exception') if something
ok

Example: AllowConsecutiveConditionals: false (default)

# bad
def test
  if foo?
    work
  end

  if bar?  # <- reports an offense
    work
  end
end

Example: AllowConsecutiveConditionals: true

# good
def test
  if foo?
    work
  end

  if bar?
    work
  end
end

# bad
def test
  if foo?
    work
  end

  do_something

  if bar?  # <- reports an offense
    work
  end
end

There are no issues that match your filters.

Category
Status