lujanfernaud/prevy

View on GitHub

Showing 1,727 of 1,727 total issues

Event#default_start_date doesn't depend on instance state (maybe move it to another class?)
Open

  def default_start_date
Severity: Minor
Found in app/models/event.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

LQIPGenerator#token doesn't depend on instance state (maybe move it to another class?)
Open

    def token
Severity: Minor
Found in app/services/lqip_generator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

GroupsController#unhidden_groups_selection_without doesn't depend on instance state (maybe move it to another class?)
Open

    def unhidden_groups_selection_without(group)
Severity: Minor
Found in app/controllers/groups_controller.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

GroupsHelper takes parameters ['group', 'user'] to 7 methods
Open

  def has_moderator_role?(user, group)
    user&.has_role? :moderator, group
  end

  def has_member_role_and_is_confirmed?(user, group)
Severity: Minor
Found in app/helpers/groups_helper.rb by reek

In general, a Data Clump occurs when the same two or three items frequently appear together in classes and parameter lists, or when a group of instance variable names start or end with similar substrings.

The recurrence of the items often means there is duplicate code spread around to handle them. There may be an abstraction missing from the code, making the system harder to understand.

Example

Given

class Dummy
  def x(y1,y2); end
  def y(y1,y2); end
  def z(y1,y2); end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [2, 3, 4]:Dummy takes parameters [y1, y2] to 3 methods (DataClump)

A possible way to fix this problem (quoting from Martin Fowler):

The first step is to replace data clumps with objects and use the objects whenever you see them. An immediate benefit is that you'll shrink some parameter lists. The interesting stuff happens as you begin to look for behavior to move into the new objects.

User::NotificationsHelper#resource_link? doesn't depend on instance state (maybe move it to another class?)
Open

  def resource_link?(notification)

A Utility Function is any instance method that has no dependency on the state of the instance.

GroupDecorator#role_count doesn't depend on instance state (maybe move it to another class?)
Open

    def role_count(count)
Severity: Minor
Found in app/decorators/group_decorator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Application::AlertHelpers#create_group_text doesn't depend on instance state (maybe move it to another class?)
Open

  def create_group_text

A Utility Function is any instance method that has no dependency on the state of the instance.

UpdatedEventNotifier#simplified_name_for doesn't depend on instance state (maybe move it to another class?)
Open

    def simplified_name_for(field_name)

A Utility Function is any instance method that has no dependency on the state of the instance.

Event#default_end_date doesn't depend on instance state (maybe move it to another class?)
Open

  def default_end_date
Severity: Minor
Found in app/models/event.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

GroupsHelper#has_membership? doesn't depend on instance state (maybe move it to another class?)
Open

  def has_membership?(user, group)
Severity: Minor
Found in app/helpers/groups_helper.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

GroupsHelper#is_group_owner? doesn't depend on instance state (maybe move it to another class?)
Open

  def is_group_owner?(user, group)
Severity: Minor
Found in app/helpers/groups_helper.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

LQIPGenerator#prepare_temporary_folder doesn't depend on instance state (maybe move it to another class?)
Open

    def prepare_temporary_folder
Severity: Minor
Found in app/services/lqip_generator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

AnnouncementTopic#date doesn't depend on instance state (maybe move it to another class?)
Open

    def date
Severity: Minor
Found in app/models/announcement_topic.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

Application::AlertHelpers#show_group_text doesn't depend on instance state (maybe move it to another class?)
Open

  def show_group_text

A Utility Function is any instance method that has no dependency on the state of the instance.

SampleEventCreator#event_start_date doesn't depend on instance state (maybe move it to another class?)
Open

    def event_start_date
Severity: Minor
Found in app/services/sample_event_creator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

SampleEventCreator#event_title doesn't depend on instance state (maybe move it to another class?)
Open

    def event_title
Severity: Minor
Found in app/services/sample_event_creator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

SampleEventCreator#event_description doesn't depend on instance state (maybe move it to another class?)
Open

    def event_description
Severity: Minor
Found in app/services/sample_event_creator.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

SampleCommentsCreator#last_comment_date doesn't depend on instance state (maybe move it to another class?)
Open

    def last_comment_date(topic)

A Utility Function is any instance method that has no dependency on the state of the instance.

ImageUploader#cache_dir doesn't depend on instance state (maybe move it to another class?)
Open

  def cache_dir
Severity: Minor
Found in app/uploaders/image_uploader.rb by reek

A Utility Function is any instance method that has no dependency on the state of the instance.

NotificationMailer takes parameters ['group', 'user'] to 8 methods
Open

  def new_membership_request(user, group)
    @user  = user
    @group = group
    @owner = @group.owner
    @url   = user_notifications_url(@owner)
Severity: Minor
Found in app/mailers/notification_mailer.rb by reek

In general, a Data Clump occurs when the same two or three items frequently appear together in classes and parameter lists, or when a group of instance variable names start or end with similar substrings.

The recurrence of the items often means there is duplicate code spread around to handle them. There may be an abstraction missing from the code, making the system harder to understand.

Example

Given

class Dummy
  def x(y1,y2); end
  def y(y1,y2); end
  def z(y1,y2); end
end

Reek would emit the following warning:

test.rb -- 1 warning:
  [2, 3, 4]:Dummy takes parameters [y1, y2] to 3 methods (DataClump)

A possible way to fix this problem (quoting from Martin Fowler):

The first step is to replace data clumps with objects and use the objects whenever you see them. An immediate benefit is that you'll shrink some parameter lists. The interesting stuff happens as you begin to look for behavior to move into the new objects.

Severity
Category
Status
Source
Language