lujanfernaud/prevy

View on GitHub
app/queries/prioritized_topics_query.rb

Summary

Maintainability
A
0 mins
Test Coverage

PrioritizedTopicsQuery has no descriptive comment
Open

class PrioritizedTopicsQuery

Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

Example

Given

class Dummy
  # Do things...
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [1]:Dummy has no descriptive comment (IrresponsibleModule)

Fixing this is simple - just an explaining comment:

# The Dummy class is responsible for ...
class Dummy
  # Do things...
end

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

      topics.where("event_id IN (?)", past_event_ids)

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 event_topics_to_remove_priority
      past_event_ids = events.past.pluck(:id)

      topics.where("event_id IN (?)", past_event_ids)
    end

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def special_topics
      Topic.where(group: group).special.prioritized
    end

This cops checks for inconsistent indentation.

Example:

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

Line is too long. [84/80]
Open

      normal_topics_ids  = group.normal_topics.limit(normal_topics_limit).pluck(:id)

Missing top-level class documentation comment.
Open

class PrioritizedTopicsQuery

This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

Example:

# bad
class Person
  # ...
end

# good
# Description/Explanation of Person class
class Person
  # ...
end

Inconsistent indentation detected.
Open

    def remove_priority_to_past_events_topics
      return if event_topics_to_remove_priority.empty?

      event_topics_to_remove_priority.update_all(priority: 0)
    end

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    def topic_ids(normal_topics_limit)
      special_topics_ids = special_topics.pluck(:id)
      normal_topics_ids  = group.normal_topics.limit(normal_topics_limit).pluck(:id)

      special_topics_ids + normal_topics_ids

This cops checks for inconsistent indentation.

Example:

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

Inconsistent indentation detected.
Open

    attr_reader :normal_topics_limit, :group, :events, :topics

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