lujanfernaud/prevy

View on GitHub
app/services/sample_event_comments_creator.rb

Summary

Maintainability
A
0 mins
Test Coverage

Inconsistent indentation detected.
Open

    def create_comments
      build_comments
      run_comments_before_create_callbacks

      TopicComment.import(@comments)

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def build_comments
      COMMENT_SEEDS.each do |seed|
        @comments << new_comment_with(seed)
      end
    end

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def update_event_topic_dates
      topic = event_topic

      topic.update_attribute(:created_at, CREATION_DATE)
      topic.update_attribute(:last_commented_at, last_comment_creation_date)

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def update_topic_comments_count
      Topic.reset_counters(event_topic.id, :topic_comments)
    end

This cops checks for inconsistent indentation.

Example:

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

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

        body:       seed["body"],

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"

Inconsistent indentation detected.
Open

    attr_reader :event, :event_topic, :attendees

This cops checks for inconsistent indentation.

Example:

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

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

  COMMENT_SEEDS  = YAML.load_file("db/seeds/event_comment_seeds.yml").shuffle

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"

Inconsistent indentation detected.
Open

    def new_comment_with(seed)
      attendee = attendees.pop
      created_at_date = CREATION_DATE + rand(ONE_MINUTE..TWENTY_THREE_HOURS)

      event_topic.comments.new(

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def run_comments_before_create_callbacks
      @comments.each do |comment|
        comment.run_callbacks(:create) { false }
      end
    end

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def last_comment_creation_date
      event_topic.comments.last.created_at
    end

This cops checks for inconsistent indentation.

Example:

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

There are no issues that match your filters.

Category
Status