Skip to content

Commit 07c97d2

Browse files
committed
rubocop fixes
1 parent da5de30 commit 07c97d2

File tree

5 files changed

+37
-25
lines changed

5 files changed

+37
-25
lines changed

app/builders/better_together/navigation_builder.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def build_footer # rubocop:todo Metrics/MethodLength, Metrics/AbcSize
150150
end
151151

152152
def build_header # rubocop:todo Metrics/MethodLength
153-
I18n.with_locale(:en) do
153+
I18n.with_locale(:en) do # rubocop:todo Metrics/BlockLength
154154
# Create platform header pages
155155
header_pages = ::BetterTogether::Page.create(
156156
[

app/controllers/better_together/application_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def after_sign_in_path_for(resource)
170170
end
171171
end
172172

173-
def after_sign_out_path_for(resource_or_scope)
173+
def after_sign_out_path_for(_resource_or_scope)
174174
BetterTogether.base_path_with_locale
175175
end
176176
end

app/controllers/better_together/people_controller.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ def set_person
7070

7171
def set_resource_instance
7272
@resource = if me?
73-
helpers.current_person
74-
else
75-
super
76-
end
73+
helpers.current_person
74+
else
75+
super
76+
end
7777
end
7878

7979
def person_params
@@ -90,16 +90,16 @@ def resource_class
9090

9191
def resource_collection # rubocop:todo Metrics/MethodLength
9292
policy_scope(resource_class.with_translations.with_attached_profile_image.with_attached_cover_image.includes(
93-
contact_detail: %i[phone_numbers email_addresses website_links addresses social_media_accounts],
94-
person_platform_memberships: {
95-
joinable: [:string_translations, { profile_image_attachment: :blob }],
96-
role: [:string_translations]
97-
},
98-
person_community_memberships: {
99-
joinable: [:string_translations, { profile_image_attachment: :blob }],
100-
role: [:string_translations]
101-
}
102-
))
93+
contact_detail: %i[phone_numbers email_addresses website_links addresses social_media_accounts],
94+
person_platform_memberships: {
95+
joinable: [:string_translations, { profile_image_attachment: :blob }],
96+
role: [:string_translations]
97+
},
98+
person_community_memberships: {
99+
joinable: [:string_translations, { profile_image_attachment: :blob }],
100+
role: [:string_translations]
101+
}
102+
))
103103
end
104104
end
105105
end

app/controllers/better_together/users/sessions_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class SessionsController < ::Devise::SessionsController # rubocop:todo Style/Doc
99
def respond_to_on_destroy
1010
respond_to do |format|
1111
format.all { head :no_content }
12-
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name), status: :see_other}
12+
format.any(*navigational_formats) { redirect_to after_sign_out_path_for(resource_name), status: :see_other }
1313
end
1414
end
1515
end

app/helpers/better_together/image_helper.rb

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
module BetterTogether
44
# Helps with rendering images for various entities
55
module ImageHelper
6-
def cover_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength
6+
# rubocop:todo Metrics/PerceivedComplexity
7+
# rubocop:todo Metrics/CyclomaticComplexity
8+
# rubocop:todo Metrics/AbcSize
9+
def cover_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength, Metrics/AbcSize
710
image_classes = "cover-image rounded-top #{options[:class]}"
811
image_style = (options[:style]).to_s
912
image_width = options[:width] || 2400
@@ -15,7 +18,7 @@ def cover_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength
1518
class: image_classes,
1619
style: image_style,
1720
alt: image_alt,
18-
title: image_title,
21+
title: image_title
1922
}
2023

2124
# Determine if entity has a profile image
@@ -33,8 +36,14 @@ def cover_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength
3336
image_tag(image_url(default_image), **image_tag_attributes)
3437
end
3538
end
39+
# rubocop:enable Metrics/AbcSize
40+
# rubocop:enable Metrics/CyclomaticComplexity
41+
# rubocop:enable Metrics/PerceivedComplexity
3642

37-
def profile_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength
43+
# rubocop:todo Metrics/PerceivedComplexity
44+
# rubocop:todo Metrics/CyclomaticComplexity
45+
# rubocop:todo Metrics/AbcSize
46+
def profile_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength, Metrics/AbcSize
3847
image_classes = "profile-image rounded-circle #{options[:class]}"
3948
image_style = (options[:style]).to_s
4049
image_size = options[:size] || 300
@@ -59,10 +68,13 @@ def profile_image_tag(entity, options = {}) # rubocop:todo Metrics/MethodLength
5968
image_tag(attachment.url, **image_tag_attributes)
6069
else
6170
# Use a default image based on the entity type
62-
default_image = default_profile_image(entity)
71+
default_image = default_profile_image(entity, image_format)
6372
image_tag(image_url(default_image), **image_tag_attributes)
6473
end
6574
end
75+
# rubocop:enable Metrics/AbcSize
76+
# rubocop:enable Metrics/CyclomaticComplexity
77+
# rubocop:enable Metrics/PerceivedComplexity
6678

6779
private
6880

@@ -77,14 +89,14 @@ def default_cover_image(entity, image_format)
7789
end
7890
end
7991

80-
def default_profile_image(entity)
92+
def default_profile_image(entity, image_format)
8193
case entity.class.name
8294
when 'BetterTogether::Person'
83-
'profile_images/default_profile_image_person.jpg'
95+
"profile_images/default_profile_image_person.#{image_format}"
8496
when 'BetterTogether::Community'
85-
'profile_images/default_profile_image_community.jpg'
97+
"profile_images/default_profile_image_community.#{image_format}"
8698
else
87-
'profile_images/default_profile_image_generic.jpg'
99+
"profile_images/default_profile_image_generic.#{image_format}"
88100
end
89101
end
90102
end

0 commit comments

Comments
 (0)