From 47b17044d2c24eb69f6e2038d3332ffa500ca4e4 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Wed, 26 Oct 2022 13:14:08 +0000 Subject: Fix RuboCop offense Style/RedundantStringEscape (#36919). git-svn-id: https://svn.redmine.org/redmine/trunk@21920 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/repository/subversion.rb | 2 +- test/helpers/application_helper_test.rb | 6 +++--- test/system/issues_test.rb | 2 +- test/unit/lib/redmine/helpers/url_test.rb | 14 +++++++------- .../redmine/wiki_formatting/common_mark/formatter_test.rb | 2 +- .../lib/redmine/wiki_formatting/textile_formatter_test.rb | 6 +++--- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb index 4cafe4fa5..fa60492c1 100644 --- a/app/models/repository/subversion.rb +++ b/app/models/repository/subversion.rb @@ -51,7 +51,7 @@ class Repository::Subversion < Repository # Returns a path relative to the url of the repository def relative_path(path) - path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '') + path.gsub(Regexp.new("^/?#{Regexp.escape(relative_url)}"), '') end def fetch_changesets diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 64ef8a2de..a5c533a4f 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1411,7 +1411,7 @@ class ApplicationHelperTest < Redmine::HelperTest RAW expected = <<~EXPECTED -
/* Hello */document.write("Hello World!");
+
/* Hello */document.write("Hello World!");
EXPECTED with_settings :text_formatting => 'textile' do assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') @@ -1425,7 +1425,7 @@ class ApplicationHelperTest < Redmine::HelperTest RAW expected = <<~EXPECTED -
x = a & b
+
x = a & b
EXPECTED with_settings :text_formatting => 'textile' do assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') @@ -2214,7 +2214,7 @@ class ApplicationHelperTest < Redmine::HelperTest "/projects/ecookbook/wiki/A_%22quoted%22_name", :class => "wiki-page new"), '[[le français, c\'est super]]' => - link_to("le français, c\'est super", + link_to("le français, c'est super", "/projects/ecookbook/wiki/Le_fran%C3%A7ais_c'est_super", :class => "wiki-page new"), '[[broken < less]]' => diff --git a/test/system/issues_test.rb b/test/system/issues_test.rb index b987a95a1..6d19b65df 100644 --- a/test/system/issues_test.rb +++ b/test/system/issues_test.rb @@ -46,7 +46,7 @@ class IssuesSystemTest < ApplicationSystemTestCase assert_kind_of Issue, issue # check redirection - find 'div#flash_notice', :visible => true, :text => "Issue \##{issue.id} created." + find 'div#flash_notice', :visible => true, :text => "Issue ##{issue.id} created." assert_equal issue_path(:id => issue), current_path # check issue attributes diff --git a/test/unit/lib/redmine/helpers/url_test.rb b/test/unit/lib/redmine/helpers/url_test.rb index d927fd0a6..09d9b6c03 100644 --- a/test/unit/lib/redmine/helpers/url_test.rb +++ b/test/unit/lib/redmine/helpers/url_test.rb @@ -42,7 +42,7 @@ class URLTest < ActiveSupport::TestCase "mailto:foo@example.org", " http://example.com/", "", - "/javascript:alert(\'filename\')", + "/javascript:alert('filename')", ] def test_uri_with_link_safe_scheme_should_recognize_safe_uris @@ -52,18 +52,18 @@ class URLTest < ActiveSupport::TestCase end LINK_UNSAFE_URIS = [ - "javascript:alert(\'XSS\');", - "javascript :alert(\'XSS\');", - "javascript: alert(\'XSS\');", - "javascript : alert(\'XSS\');", - ":javascript:alert(\'XSS\');", + "javascript:alert('XSS');", + "javascript :alert('XSS');", + "javascript: alert('XSS');", + "javascript : alert('XSS');", + ":javascript:alert('XSS');", "javascript:", "javascript:", "javascript:", "javascript:", "java\0script:alert(\"XSS\")", "java\script:alert(\"XSS\")", - " \x0e javascript:alert(\'XSS\');", + " \x0e javascript:alert('XSS');", "data:image/png;base64,foobar", "vbscript:foobar", "data:text/html;base64,foobar", diff --git a/test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb index 2eeb28759..81d8acf5b 100644 --- a/test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/common_mark/formatter_test.rb @@ -151,7 +151,7 @@ class Redmine::WikiFormatting::CommonMark::FormatterTest < ActionView::TestCase

This is some text1.

  1. -

    This is the foot note

    +

    This is the foot note

EXPECTED diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 12e24b8a6..381cfdffc 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -512,12 +512,12 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase <<~STR.chomp, h2. Heading 2 -

+      

         def foo
         end
       
-

+      

         Place your code here.
       
@@ -693,7 +693,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase fn1. This is the foot note STR expected = <<~EXPECTED -

This is some text1.

+

This is some text1.

1 This is the foot note

EXPECTED assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '') -- cgit v1.2.3