Fix Lint/UnusedArgument issues

This commit is contained in:
syeopite 2021-09-24 19:05:25 -07:00
parent 0614b52f03
commit 20cb751ff6
No known key found for this signature in database
GPG Key ID: 6FA616E5A5294A82
11 changed files with 16 additions and 16 deletions

View File

@ -1351,7 +1351,7 @@ error 500 do |env, ex|
error_template(500, ex) error_template(500, ex)
end end
static_headers do |response, filepath, filestat| static_headers do | response |
response.headers.add("Cache-Control", "max-age=2629800") response.headers.add("Cache-Control", "max-age=2629800")
end end

View File

@ -242,7 +242,7 @@ def produce_channel_community_continuation(ucid, cursor)
}, },
} }
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }

View File

@ -84,7 +84,7 @@ def produce_channel_playlists_url(ucid, cursor, sort = "newest", auto_generated
object["80226972:embedded"]["3:string"] = Base64.urlsafe_encode(Protodec::Any.from_json(Protodec::Any.cast_json(object["80226972:embedded"]["3:base64"]))) object["80226972:embedded"]["3:string"] = Base64.urlsafe_encode(Protodec::Any.from_json(Protodec::Any.cast_json(object["80226972:embedded"]["3:base64"])))
object["80226972:embedded"].delete("3:base64") object["80226972:embedded"].delete("3:base64")
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }

View File

@ -49,7 +49,7 @@ def produce_channel_videos_continuation(ucid, page = 1, auto_generated = nil, so
object["80226972:embedded"]["3:string"] = Base64.urlsafe_encode(Protodec::Any.from_json(Protodec::Any.cast_json(object["80226972:embedded"]["3:base64"]))) object["80226972:embedded"]["3:string"] = Base64.urlsafe_encode(Protodec::Any.from_json(Protodec::Any.cast_json(object["80226972:embedded"]["3:base64"])))
object["80226972:embedded"].delete("3:base64") object["80226972:embedded"].delete("3:base64")
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }

View File

@ -638,7 +638,7 @@ def produce_comment_continuation(video_id, cursor = "", sort_by = "top")
object["6:embedded"].as(Hash)["4:embedded"].as(Hash)["6:varint"] = 0_i64 object["6:embedded"].as(Hash)["4:embedded"].as(Hash)["6:varint"] = 0_i64
end end
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }
@ -673,7 +673,7 @@ def produce_comment_reply_continuation(video_id, ucid, comment_id)
}, },
} }
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }

View File

@ -62,7 +62,7 @@ struct SearchVideo
if xml if xml
to_xml(HOST_URL, auto_generated, query_params, xml) to_xml(HOST_URL, auto_generated, query_params, xml)
else else
XML.build do |json| XML.build do |xml|
to_xml(HOST_URL, auto_generated, query_params, xml) to_xml(HOST_URL, auto_generated, query_params, xml)
end end
end end

View File

@ -30,7 +30,7 @@ struct DecryptFunction
case op_body case op_body
when "{a.reverse()" when "{a.reverse()"
operations[op_name] = ->(a : Array(String), b : Int32) { a.reverse } operations[op_name] = ->(a : Array(String), _b : Int32) { a.reverse }
when "{a.splice(0,b)" when "{a.splice(0,b)"
operations[op_name] = ->(a : Array(String), b : Int32) { a.delete_at(0..(b - 1)); a } operations[op_name] = ->(a : Array(String), b : Int32) { a.delete_at(0..(b - 1)); a }
else else

View File

@ -51,7 +51,7 @@ struct PlaylistVideo
if xml if xml
to_xml(auto_generated, xml) to_xml(auto_generated, xml)
else else
XML.build do |json| XML.build do |xml| # Why was this `json`?
to_xml(auto_generated, xml) to_xml(auto_generated, xml)
end end
end end
@ -143,7 +143,7 @@ struct Playlist
json.field "videos" do json.field "videos" do
json.array do json.array do
videos = get_playlist_videos(PG_DB, self, offset: offset, locale: locale, video_id: video_id) videos = get_playlist_videos(PG_DB, self, offset: offset, locale: locale, video_id: video_id)
videos.each_with_index do |video, index| videos.each do |video|
video.to_json(locale, json) video.to_json(locale, json)
end end
end end
@ -336,7 +336,7 @@ def produce_playlist_continuation(id, index)
}, },
} }
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }

View File

@ -335,7 +335,7 @@ module Invidious::Routes::API::V1::Authenticated
case env.request.headers["Content-Type"]? case env.request.headers["Content-Type"]?
when "application/x-www-form-urlencoded" when "application/x-www-form-urlencoded"
scopes = env.params.body.select { |k, v| k.match(/^scopes\[\d+\]$/) }.map { |k, v| v } scopes = env.params.body.select { |k, _| k.match(/^scopes\[\d+\]$/) }.map { |_, v| v }
callback_url = env.params.body["callbackUrl"]? callback_url = env.params.body["callbackUrl"]?
expire = env.params.body["expire"]?.try &.to_i? expire = env.params.body["expire"]?.try &.to_i?
when "application/json" when "application/json"

View File

@ -395,7 +395,7 @@ module Invidious::Routes::Login
return templated "login" return templated "login"
end end
tokens = env.params.body.select { |k, v| k.match(/^token\[\d+\]$/) }.map { |k, v| v } tokens = env.params.body.select { |k, _| k.match(/^token\[\d+\]$/) }.map { |_, v| v }
answer ||= "" answer ||= ""
captcha_type ||= "image" captcha_type ||= "image"
@ -419,7 +419,7 @@ module Invidious::Routes::Login
found_valid_captcha = false found_valid_captcha = false
error_exception = Exception.new error_exception = Exception.new
tokens.each_with_index do |token, i| tokens.each do |token|
begin begin
validate_request(token, answer, env.request, HMAC_KEY, PG_DB, locale) validate_request(token, answer, env.request, HMAC_KEY, PG_DB, locale)
found_valid_captcha = true found_valid_captcha = true

View File

@ -128,7 +128,7 @@ def produce_search_params(page = 1, sort : String = "relevance", date : String =
object.delete("2:embedded") object.delete("2:embedded")
end end
params = object.try { |i| Protodec::Any.cast_json(object) } params = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }
@ -161,7 +161,7 @@ def produce_channel_search_continuation(ucid, query, page)
}, },
} }
continuation = object.try { |i| Protodec::Any.cast_json(object) } continuation = object.try { |i| Protodec::Any.cast_json(i) }
.try { |i| Protodec::Any.from_json(i) } .try { |i| Protodec::Any.from_json(i) }
.try { |i| Base64.urlsafe_encode(i) } .try { |i| Base64.urlsafe_encode(i) }
.try { |i| URI.encode_www_form(i) } .try { |i| URI.encode_www_form(i) }