infusionvlc/infusion

View on GitHub
app/controllers/meetups_controller.rb

Summary

Maintainability
A
0 mins
Test Coverage

Class has too many lines. [135/100]
Open

class MeetupsController < ApplicationController
  before_action :set_meetup, only: %i[show edit update destroy leave repeat]

  include MarkdownConcern

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [21/20]
Open

  def create
    @meetup = Meetup.new(meetup_params)
    @meetup.on_ranking = true
    authorize @meetup
    respond_to do |format|

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Use safe navigation (&.) instead of checking if an object exists before calling the method.
Open

    @video = @meetup.video_url[/=(.*)/][1..-1] if (@meetup.video_url && \
                                                   @meetup.video_url.length.positive?)

This cop transforms usages of a method call safeguarded by a non nil check for the variable whose method is being called to safe navigation (&.).

Configuration option: ConvertCodeThatCanStartToReturnNil The default for this is false. When configured to true, this will check for code in the format !foo.nil? && foo.bar. As it is written, the return of this code is limited to false and whatever the return of the method is. If this is converted to safe navigation, foo&.bar can start returning nil as well as what the method returns.

Example:

# bad
foo.bar if foo
foo.bar(param1, param2) if foo
foo.bar { |e| e.something } if foo
foo.bar(param) { |e| e.something } if foo

foo.bar if !foo.nil?
foo.bar unless !foo
foo.bar unless foo.nil?

foo && foo.bar
foo && foo.bar(param1, param2)
foo && foo.bar { |e| e.something }
foo && foo.bar(param) { |e| e.something }

# good
foo&.bar
foo&.bar(param1, param2)
foo&.bar { |e| e.something }
foo&.bar(param) { |e| e.something }

foo.nil? || foo.bar
!foo || foo.bar

# Methods that `nil` will `respond_to?` should not be converted to
# use safe navigation
foo.to_i if foo

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

                                 "assistances ON assistances.session_id = meetup_sessions.id")

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"

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

                          .joins("LEFT OUTER JOIN sessions AS meetup_sessions ON " +

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

    @most_popular = Meetup.active.joins(:events).where('events.date < ?', Date.today)

Use \ instead of + or << to concatenate those strings.
Open

                          .joins("LEFT OUTER JOIN sessions AS meetup_sessions ON " +

This cop checks for string literal concatenation at the end of a line.

Example:

# bad
some_str = 'ala' +
           'bala'

some_str = 'ala' <<
           'bala'

# good
some_str = 'ala' \
           'bala'

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

                            "assistances ON assistances.session_id = meetup_sessions.id")

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"

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

                            "meetup_sessions.meetup_id = meetups.id LEFT OUTER JOIN " +

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

                            "meetup_sessions.meetup_id = meetups.id LEFT OUTER JOIN " +

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

                     .joins("LEFT OUTER JOIN sessions AS meetup_sessions ON " +

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

                                 "assistances ON assistances.session_id = meetup_sessions.id")

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

                                 "meetup_sessions.meetup_id = meetups.id LEFT OUTER JOIN " +

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

                                                   @meetup.video_url.length.positive?)

Line is too long. [82/80]
Open

    @reviews = @meetup.assistances.where.not(review: nil).order(created_at: :desc)

Use \ instead of + or << to concatenate those strings.
Open

                            "meetup_sessions.meetup_id = meetups.id LEFT OUTER JOIN " +

This cop checks for string literal concatenation at the end of a line.

Example:

# bad
some_str = 'ala' +
           'bala'

some_str = 'ala' <<
           'bala'

# good
some_str = 'ala' \
           'bala'

Don't use parentheses around the condition of an if.
Open

    @video = @meetup.video_url[/=(.*)/][1..-1] if (@meetup.video_url && \
                                                   @meetup.video_url.length.positive?)

This cop checks for the presence of superfluous parentheses around the condition of if/unless/while/until.

Example:

# bad
x += 1 while (x < 10)
foo unless (bar || baz)

if (x > 10)
elsif (x < 3)
end

# good
x += 1 while x < 10
foo unless bar || baz

if x > 10
elsif x < 3
end

Use 2 (not 0) spaces for indentation.
Open

    MeetupMailer.notify_abandon(@meetup, host.user, current_user).deliver

This cops checks for indentation that doesn't use the specified number of spaces.

See also the IndentationConsistency cop which is the companion to this one.

Example:

# bad
class A
 def test
  puts 'hello'
 end
end

# good
class A
  def test
    puts 'hello'
  end
end

Example: IgnoredPatterns: ['^\s*module']

# bad
module A
class B
  def test
  puts 'hello'
  end
end
end

# good
module A
class B
  def test
    puts 'hello'
  end
end
end

Line is too long. [84/80]
Open

    @most_recent = Meetup.active.joins(:events).where('events.date < ?', Date.today)

Line is too long. [84/80]
Open

                          .joins("LEFT OUTER JOIN sessions AS meetup_sessions ON " +

Use \ instead of + or << to concatenate those strings.
Open

                     .joins("LEFT OUTER JOIN sessions AS meetup_sessions ON " +

This cop checks for string literal concatenation at the end of a line.

Example:

# bad
some_str = 'ala' +
           'bala'

some_str = 'ala' <<
           'bala'

# good
some_str = 'ala' \
           'bala'

Line is too long. [89/80]
Open

                            "assistances ON assistances.session_id = meetup_sessions.id")

Line is too long. [92/80]
Open

                                 "meetup_sessions.meetup_id = meetups.id LEFT OUTER JOIN " +

Use \ instead of + or << to concatenate those strings.
Open

                                 "meetup_sessions.meetup_id = meetups.id LEFT OUTER JOIN " +

This cop checks for string literal concatenation at the end of a line.

Example:

# bad
some_str = 'ala' +
           'bala'

some_str = 'ala' <<
           'bala'

# good
some_str = 'ala' \
           'bala'

There are no issues that match your filters.

Category
Status