Fix Style/RedundantBegin type of Ameba issues

This commit is contained in:
Sijawusz Pur Rahnama 2026-01-11 23:17:05 +01:00
parent 5f1c9849bf
commit 9f96682783
4 changed files with 21 additions and 30 deletions

View File

@ -31,9 +31,6 @@ Lint/SpecFilename:
# Style
#
Style/RedundantBegin:
Enabled: false
Style/RedundantReturn:
Enabled: false

View File

@ -64,20 +64,18 @@ struct Preferences
end
def self.from_json(value : JSON::PullParser) : String
begin
result = value.read_string
result = value.read_string
if result.empty?
CONFIG.default_user_preferences.dark_mode
else
result
end
rescue ex
if value.read_bool
"dark"
else
"light"
end
if result.empty?
CONFIG.default_user_preferences.dark_mode
else
result
end
rescue ex
if value.read_bool
"dark"
else
"light"
end
end

View File

@ -17,11 +17,9 @@ struct Invidious::User
module PreferencesConverter
def self.from_rs(rs)
begin
Preferences.from_json(rs.read(String))
rescue ex
Preferences.from_json("{}")
end
Preferences.from_json(rs.read(String))
rescue ex
Preferences.from_json("{}")
end
end
end

View File

@ -37,15 +37,13 @@ record AuthorFallback, name : String, id : String
private module Parsers
module BaseParser
def parse(*args)
begin
return parse_internal(*args)
rescue ex
LOGGER.debug("#{{{ @type.name }}}: Failed to render item.")
LOGGER.debug("#{{{ @type.name }}}: Got exception: #{ex.message}")
ProblematicTimelineItem.new(
parse_exception: ex
)
end
return parse_internal(*args)
rescue ex
LOGGER.debug("#{{{ @type.name }}}: Failed to render item.")
LOGGER.debug("#{{{ @type.name }}}: Got exception: #{ex.message}")
ProblematicTimelineItem.new(
parse_exception: ex
)
end
end