Skip to content

Commit

Permalink
Fix rubocop warning (mastodon#14288)
Browse files Browse the repository at this point in the history
* Fix rubocop warning

* use limit variable

* use ContextCreatingMethods option
  • Loading branch information
abcang authored and Mage committed Jan 14, 2022
1 parent bc24451 commit 519927d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ Layout/EmptyLineAfterMagicComment:
Layout/SpaceInsideHashLiteralBraces:
EnforcedStyle: space

Lint/UselessAccessModifier:
ContextCreatingMethods:
- class_methods

Metrics/AbcSize:
Max: 100

Expand Down
2 changes: 1 addition & 1 deletion app/controllers/tags_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def show
expires_in 0, public: true

limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE
@statuses = HashtagQueryService.new.call(@tag, filter_params, nil, @local).limit(PAGE_SIZE)
@statuses = HashtagQueryService.new.call(@tag, filter_params, nil, @local).limit(limit)
@statuses = cache_collection(@statuses, Status)

render xml: RSS::TagSerializer.render(@tag, @statuses)
Expand Down
2 changes: 1 addition & 1 deletion app/lib/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ def open(host, *args)
begin
sock.connect_nonblock(addr_by_socket[sock])
rescue Errno::EISCONN
# nothing to do
# Do nothing
rescue => e
sock.close
outer_e = e
Expand Down
2 changes: 2 additions & 0 deletions app/lib/settings/scoped_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def initialize(object)
@object = object
end

# rubocop:disable Style/MethodMissingSuper
def method_missing(method, *args)
method_name = method.to_s
# set a value for a variable
Expand All @@ -23,6 +24,7 @@ def method_missing(method, *args)
self[method_name]
end
end
# rubocop:enable Style/MethodMissingSuper

def respond_to_missing?(*)
true
Expand Down

0 comments on commit 519927d

Please sign in to comment.