Skip to content

Commit ce3e68f

Browse files
committed
Rubocop fixes
1 parent 3073e20 commit ce3e68f

File tree

3 files changed

+19
-9
lines changed

3 files changed

+19
-9
lines changed

app/models/concerns/better_together/attachments/images.rb

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,40 @@
1+
# frozen_string_literal: true
12

23
module BetterTogether
34
module Attachments
5+
# Single place to manage logic for attached images
46
module Images
57
extend ActiveSupport::Concern
68

7-
VALID_IMAGE_CONTENT_TYPES = %w[image/jpeg image/png image/gif image/webp image/svg+xml].freeze
9+
VALID_IMAGE_CONTENT_TYPES = %w[
10+
image/jpeg image/png image/gif image/webp image/svg+xml
11+
].freeze
812

913
included do
10-
def self.attachable_cover_image
14+
def self.attachable_cover_image # rubocop:todo Metrics/MethodLength
1115
has_one_attached :cover_image do |attachable|
1216
attachable.variant :optimized_jpeg, resize_to_limit: [2400, 1200],
1317
# rubocop:todo Layout/LineLength
1418
saver: { strip: true, quality: 85, interlace: true, optimize_coding: true, trellis_quant: true, quant_table: 3 }, format: 'jpg'
1519
# rubocop:enable Layout/LineLength
1620
attachable.variant :optimized_png, resize_to_limit: [2400, 1200],
17-
saver: { strip: true, quality: 85, optimize_coding: true }, format: 'png'
21+
saver: { strip: true, quality: 85, optimize_coding: true }, format: 'png'
1822

1923
attachable.variant :optimized_card_jpeg, resize_to_limit: [1200, 300],
20-
# rubocop:todo Layout/LineLength
21-
saver: { strip: true, quality: 90, interlace: true, optimize_coding: true, trellis_quant: true, quant_table: 3 }, format: 'jpg'
24+
# rubocop:todo Layout/LineLength
25+
saver: { strip: true, quality: 90, interlace: true, optimize_coding: true, trellis_quant: true, quant_table: 3 }, format: 'jpg'
2226
# rubocop:enable Layout/LineLength
2327
attachable.variant :optimized_card_png, resize_to_limit: [1200, 300],
28+
# rubocop:todo Layout/LineLength
2429
saver: { strip: true, quality: 90, optimize_coding: true }, format: 'png'
30+
# rubocop:enable Layout/LineLength
2531
end
2632

2733
validates :cover_image,
2834
content_type: VALID_IMAGE_CONTENT_TYPES,
2935
size: { less_than: 100.megabytes, message: 'is too large' }
3036

31-
alias card_image cover_image
37+
alias_method :card_image, :cover_image
3238

3339
attr_accessor :remove_cover_image
3440

@@ -73,4 +79,4 @@ def optimized_cover_image
7379
end
7480
end
7581
end
76-
end
82+
end

app/models/concerns/better_together/categorizable.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ module Categorizable # rubocop:todo Style/Documentation
1010
end
1111

1212
class_methods do
13-
def categorizable(class_name: category_class_name)
13+
def categorizable(class_name: category_class_name) # rubocop:todo Metrics/MethodLength
1414
self.category_class_name = class_name
1515

1616
has_many :categorizations, class_name: 'BetterTogether::Categorization', as: :categorizable, dependent: :destroy
1717
has_many :categories, through: :categorizations, source_type: category_class_name do
18-
def with_cover_images
18+
def with_cover_images # rubocop:todo Lint/NestedMethodDefinition
1919
left_joins(:cover_image_attachment).where.not(active_storage_attachments: { id: nil })
2020
end
2121
end

config/initializers/rack_attack.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,12 @@ class Attack
2323

2424
safelist('allow monitors') do |req|
2525
allowed_user_agents = [
26+
# rubocop:todo Layout/LineLength
2627
'Better Stack Better Uptime Bot Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36',
28+
# rubocop:enable Layout/LineLength
29+
# rubocop:todo Layout/LineLength
2730
'Better Uptime Bot Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36'
31+
# rubocop:enable Layout/LineLength
2832
]
2933
# Requests are allowed if the return value is truthy
3034
allowed_user_agents.include?(req.user_agent)

0 commit comments

Comments
 (0)