From 98aafd06bacea24fbccef0b1f3a20c53067513d3 Mon Sep 17 00:00:00 2001 From: Marius Balteanu Date: Sun, 3 Mar 2024 22:38:03 +0000 Subject: Fix rubocop warnings on 5.0-stable branch. git-svn-id: https://svn.redmine.org/redmine/branches/5.0-stable@22763 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 1 + lib/redmine/wiki_formatting/common_mark/external_links_filter.rb | 6 +++++- test/functional/issues_controller_test.rb | 2 +- test/functional/messages_controller_test.rb | 2 +- test/system/inline_autocomplete_test.rb | 1 - test/unit/lib/redmine/acts/mentionable_test.rb | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7603198d4..950cc4c48 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -296,6 +296,7 @@ module ApplicationHelper end when 'CustomValue', 'CustomFieldValue' return "" unless object.customized&.visible? + if object.custom_field f = object.custom_field.format.formatted_custom_value(self, object, html) if f.nil? || f.is_a?(String) diff --git a/lib/redmine/wiki_formatting/common_mark/external_links_filter.rb b/lib/redmine/wiki_formatting/common_mark/external_links_filter.rb index 2928fb990..5fd31091b 100644 --- a/lib/redmine/wiki_formatting/common_mark/external_links_filter.rb +++ b/lib/redmine/wiki_formatting/common_mark/external_links_filter.rb @@ -31,7 +31,11 @@ module Redmine next unless url next if url.starts_with?("/") || url.starts_with?("#") || !url.include?(':') - scheme = URI.parse(url).scheme rescue nil + scheme = begin + URI.parse(url).scheme + rescue + nil + end next if scheme.blank? klass = node["class"].presence diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb index 412d65e88..0faccb8be 100644 --- a/test/functional/issues_controller_test.rb +++ b/test/functional/issues_controller_test.rb @@ -1187,7 +1187,7 @@ class IssuesControllerTest < Redmine::ControllerTest create!( :name => 'Long text', :field_format => 'text', :full_width_layout => '1', - :tracker_ids => [1,3], :is_for_all => true + :tracker_ids => [1, 3], :is_for_all => true ) issue = Issue.find(1) issue.custom_field_values = {field.id => 'This is a long text'} diff --git a/test/functional/messages_controller_test.rb b/test/functional/messages_controller_test.rb index 137e95085..317e121ef 100644 --- a/test/functional/messages_controller_test.rb +++ b/test/functional/messages_controller_test.rb @@ -318,7 +318,7 @@ class MessagesControllerTest < Redmine::ControllerTest :params => { :board_id => 1, :id => 3 - }, + } ) assert_response 404 diff --git a/test/system/inline_autocomplete_test.rb b/test/system/inline_autocomplete_test.rb index 26fba9ccd..be1765b6b 100644 --- a/test/system/inline_autocomplete_test.rb +++ b/test/system/inline_autocomplete_test.rb @@ -201,7 +201,6 @@ class InlineAutocompleteSystemTest < ApplicationSystemTestCase within('.tribute-container') do assert page.has_text? "Dave Lopper" end - end def test_inline_autocomplete_for_users_on_issues_bulk_edit_show_autocomplete diff --git a/test/unit/lib/redmine/acts/mentionable_test.rb b/test/unit/lib/redmine/acts/mentionable_test.rb index 363736f2a..f9dcd7629 100644 --- a/test/unit/lib/redmine/acts/mentionable_test.rb +++ b/test/unit/lib/redmine/acts/mentionable_test.rb @@ -29,7 +29,7 @@ class Redmine::Acts::MentionableTest < ActiveSupport::TestCase :issues def test_mentioned_users_with_user_mention - to_test = %w(@dlopper @dlopper! @dlopper? @dlopper. @dlopper,) + to_test = %w(@dlopper @dlopper! @dlopper? @dlopper. @dlopper) to_test.each do |item| issue = Issue.generate!(project_id: 1, description: item) -- cgit v1.2.3