Enable Rubocop for app/views (#23874)

This commit is contained in:
Nick Schonning 2023-03-04 18:33:52 -05:00 committed by GitHub
parent 14f0b48fb6
commit 82a6cf4012
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 14 deletions

View File

@ -19,7 +19,6 @@ AllCops:
NewCops: enable NewCops: enable
Exclude: Exclude:
- db/schema.rb - db/schema.rb
- 'app/views/**/*'
- 'config/**/*' - 'config/**/*'
- 'bin/*' - 'bin/*'
- 'Rakefile' - 'Rakefile'

View File

@ -5,7 +5,7 @@ RSS::Builder.build do |doc|
doc.image(full_asset_url(@account.avatar.url(:original)), display_name(@account), params[:tag].present? ? short_account_tag_url(@account, params[:tag]) : short_account_url(@account)) doc.image(full_asset_url(@account.avatar.url(:original)), display_name(@account), params[:tag].present? ? short_account_tag_url(@account, params[:tag]) : short_account_url(@account))
doc.last_build_date(@statuses.first.created_at) if @statuses.any? doc.last_build_date(@statuses.first.created_at) if @statuses.any?
doc.icon(full_asset_url(@account.avatar.url(:original))) doc.icon(full_asset_url(@account.avatar.url(:original)))
doc.generator("Mastodon v#{Mastodon::Version.to_s}") doc.generator("Mastodon v#{Mastodon::Version}")
@statuses.each do |status| @statuses.each do |status|
doc.item do |item| doc.item do |item|
@ -18,12 +18,12 @@ RSS::Builder.build do |doc|
item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size) item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size)
end end
status.ordered_media_attachments.each do |media| status.ordered_media_attachments.each do |media_attachment|
item.media_content(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size) do |media_content| item.media_content(full_asset_url(media_attachment.file.url(:original, false)), media_attachment.file.content_type, media_attachment.file.size) do |media_content|
media_content.medium(media.gifv? ? 'image' : media.type.to_s) media_content.medium(media_attachment.gifv? ? 'image' : media_attachment.type.to_s)
media_content.rating(status.sensitive? ? 'adult' : 'nonadult') media_content.rating(status.sensitive? ? 'adult' : 'nonadult')
media_content.description(media.description) if media.description.present? media_content.description(media_attachment.description) if media_attachment.description.present?
media_content.thumbnail(media.thumbnail.url(:original, false)) if media.thumbnail? media_content.thumbnail(media_attachment.thumbnail.url(:original, false)) if media_attachment.thumbnail?
end end
end end

View File

@ -3,7 +3,7 @@ RSS::Builder.build do |doc|
doc.description(I18n.t('rss.descriptions.tag', hashtag: @tag.display_name)) doc.description(I18n.t('rss.descriptions.tag', hashtag: @tag.display_name))
doc.link(tag_url(@tag)) doc.link(tag_url(@tag))
doc.last_build_date(@statuses.first.created_at) if @statuses.any? doc.last_build_date(@statuses.first.created_at) if @statuses.any?
doc.generator("Mastodon v#{Mastodon::Version.to_s}") doc.generator("Mastodon v#{Mastodon::Version}")
@statuses.each do |status| @statuses.each do |status|
doc.item do |item| doc.item do |item|
@ -16,12 +16,12 @@ RSS::Builder.build do |doc|
item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size) item.enclosure(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size)
end end
status.ordered_media_attachments.each do |media| status.ordered_media_attachments.each do |media_attachment|
item.media_content(full_asset_url(media.file.url(:original, false)), media.file.content_type, media.file.size) do |media_content| item.media_content(full_asset_url(media_attachment.file.url(:original, false)), media_attachment.file.content_type, media_attachment.file.size) do |media_content|
media_content.medium(media.gifv? ? 'image' : media.type.to_s) media_content.medium(media_attachment.gifv? ? 'image' : media_attachment.type.to_s)
media_content.rating(status.sensitive? ? 'adult' : 'nonadult') media_content.rating(status.sensitive? ? 'adult' : 'nonadult')
media_content.description(media.description) if media.description.present? media_content.description(media_attachment.description) if media_attachment.description.present?
media_content.thumbnail(media.thumbnail.url(:original, false)) if media.thumbnail? media_content.thumbnail(media_attachment.thumbnail.url(:original, false)) if media_attachment.thumbnail?
end end
end end

View File

@ -9,4 +9,4 @@ doc << Ox::Element.new('XRD').tap do |xrd|
end end
end end
('<?xml version="1.0" encoding="UTF-8"?>' + Ox.dump(doc, effort: :tolerant)).force_encoding('UTF-8') "<?xml version=\"1.0\" encoding=\"UTF-8\"?>#{Ox.dump(doc, effort: :tolerant)}".force_encoding('UTF-8')