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
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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
- Read upRead up
- Exclude checks
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)
- Read upRead up
- Exclude checks
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.