mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-17 02:18:51 +00:00
Fix more 'Lint/ShadowingOuterLocalVar' warnings reported by ameba
This commit is contained in:
@@ -94,8 +94,8 @@ def translate(locale : String?, key : String, text : String | Nil = nil) : Strin
|
||||
translation = ""
|
||||
match_length = 0
|
||||
|
||||
raw_data.as_h.each do |key, value|
|
||||
if md = text.try &.match(/#{key}/)
|
||||
raw_data.as_h.each do |hash_key, value|
|
||||
if md = text.try &.match(/#{hash_key}/)
|
||||
if md[0].size >= match_length
|
||||
translation = value.as_s
|
||||
match_length = md[0].size
|
||||
|
||||
@@ -98,9 +98,9 @@ module JSONFilter
|
||||
end
|
||||
end
|
||||
|
||||
group_name.split('/').each do |group_name|
|
||||
group_name.split('/').each do |name|
|
||||
nest_stack.push({
|
||||
group_name: group_name,
|
||||
group_name: name,
|
||||
closing_bracket_index: closing_bracket_index,
|
||||
})
|
||||
end
|
||||
|
||||
@@ -175,9 +175,9 @@ module Kemal
|
||||
|
||||
if @cached_files.sum(&.[1][:data].bytesize) + (size = File.size(file_path)) < CACHE_LIMIT
|
||||
data = Bytes.new(size)
|
||||
File.open(file_path) do |file|
|
||||
file.read(data)
|
||||
end
|
||||
|
||||
File.open(file_path) { |f| f.read(data) }
|
||||
|
||||
filestat = File.info(file_path)
|
||||
|
||||
@cached_files[file_path] = {data: data, filestat: filestat}
|
||||
|
||||
@@ -42,6 +42,9 @@ end
|
||||
def sign_token(key, hash)
|
||||
string_to_sign = [] of String
|
||||
|
||||
# TODO: figure out which "key" variable is used
|
||||
# Ameba reports a warning for "Lint/ShadowingOuterLocalVar" on this
|
||||
# variable, but its preferrable to not touch that (works fine atm).
|
||||
hash.each do |key, value|
|
||||
next if key == "signature"
|
||||
|
||||
|
||||
@@ -292,8 +292,8 @@ def parse_range(range)
|
||||
end
|
||||
|
||||
ranges = range.lchop("bytes=").split(',')
|
||||
ranges.each do |range|
|
||||
start_range, end_range = range.split('-')
|
||||
ranges.each do |r|
|
||||
start_range, end_range = r.split('-')
|
||||
|
||||
start_range = start_range.to_i64? || 0_i64
|
||||
end_range = end_range.to_i64?
|
||||
|
||||
Reference in New Issue
Block a user