Fix RuboCop offense Style/RedundantStringEscape (#36919).

git-svn-id: https://svn.redmine.org/redmine/trunk@21920 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2022-10-26 13:14:08 +00:00
parent 4cbb07ba43
commit 47b17044d2
6 changed files with 16 additions and 16 deletions

View File

@@ -51,7 +51,7 @@ class Repository::Subversion < Repository
# Returns a path relative to the url of the repository # Returns a path relative to the url of the repository
def relative_path(path) def relative_path(path)
path.gsub(Regexp.new("^\/?#{Regexp.escape(relative_url)}"), '') path.gsub(Regexp.new("^/?#{Regexp.escape(relative_url)}"), '')
end end
def fetch_changesets def fetch_changesets

View File

@@ -1411,7 +1411,7 @@ class ApplicationHelperTest < Redmine::HelperTest
</code></pre> </code></pre>
RAW RAW
expected = <<~EXPECTED expected = <<~EXPECTED
<pre><code class="ECMA_script syntaxhl" data-language=\"ECMA_script\"><span class="cm">/* Hello */</span><span class="nb">document</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="dl">"</span><span class="s2">Hello World!</span><span class="dl">"</span><span class="p">);</span></code></pre> <pre><code class="ECMA_script syntaxhl" data-language="ECMA_script"><span class="cm">/* Hello */</span><span class="nb">document</span><span class="p">.</span><span class="nx">write</span><span class="p">(</span><span class="dl">"</span><span class="s2">Hello World!</span><span class="dl">"</span><span class="p">);</span></code></pre>
EXPECTED EXPECTED
with_settings :text_formatting => 'textile' do with_settings :text_formatting => 'textile' do
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
@@ -1425,7 +1425,7 @@ class ApplicationHelperTest < Redmine::HelperTest
</code></pre> </code></pre>
RAW RAW
expected = <<~EXPECTED expected = <<~EXPECTED
<pre><code class=\"ruby syntaxhl\" data-language=\"ruby\"><span class=\"n\">x</span> <span class=\"o\">=</span> <span class=\"n\">a</span> <span class=\"o\">&amp;</span> <span class=\"n\">b</span></code></pre> <pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">x</span> <span class="o">=</span> <span class="n">a</span> <span class="o">&amp;</span> <span class="n">b</span></code></pre>
EXPECTED EXPECTED
with_settings :text_formatting => 'textile' do with_settings :text_formatting => 'textile' do
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '') 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", "/projects/ecookbook/wiki/A_%22quoted%22_name",
:class => "wiki-page new"), :class => "wiki-page new"),
'[[le français, c\'est super]]' => '[[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", "/projects/ecookbook/wiki/Le_fran%C3%A7ais_c'est_super",
:class => "wiki-page new"), :class => "wiki-page new"),
'[[broken < less]]' => '[[broken < less]]' =>

View File

@@ -46,7 +46,7 @@ class IssuesSystemTest < ApplicationSystemTestCase
assert_kind_of Issue, issue assert_kind_of Issue, issue
# check redirection # 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 assert_equal issue_path(:id => issue), current_path
# check issue attributes # check issue attributes

View File

@@ -42,7 +42,7 @@ class URLTest < ActiveSupport::TestCase
"mailto:foo@example.org", "mailto:foo@example.org",
" http://example.com/", " http://example.com/",
"", "",
"/javascript:alert(\'filename\')", "/javascript:alert('filename')",
] ]
def test_uri_with_link_safe_scheme_should_recognize_safe_uris def test_uri_with_link_safe_scheme_should_recognize_safe_uris
@@ -52,18 +52,18 @@ class URLTest < ActiveSupport::TestCase
end end
LINK_UNSAFE_URIS = [ 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&#58;", "javascript&#58;",
"javascript&#0058;", "javascript&#0058;",
"javascript&#x3A;", "javascript&#x3A;",
"javascript&#x003A;", "javascript&#x003A;",
"java\0script:alert(\"XSS\")", "java\0script:alert(\"XSS\")",
"java\script:alert(\"XSS\")", "java\script:alert(\"XSS\")",
" \x0e javascript:alert(\'XSS\');", " \x0e javascript:alert('XSS');",
"data:image/png;base64,foobar", "data:image/png;base64,foobar",
"vbscript:foobar", "vbscript:foobar",
"data:text/html;base64,foobar", "data:text/html;base64,foobar",

View File

@@ -151,7 +151,7 @@ class Redmine::WikiFormatting::CommonMark::FormatterTest < ActionView::TestCase
<p>This is some text<sup><a href="#fn-1" id="fnref-1">1</a></sup>.</p> <p>This is some text<sup><a href="#fn-1" id="fnref-1">1</a></sup>.</p>
<ol> <ol>
<li id="fn-1"> <li id="fn-1">
<p>This is the foot note <a href="#fnref-1" aria-label=\"Back to content\">↩</a></p> <p>This is the foot note <a href="#fnref-1" aria-label="Back to content">↩</a></p>
</li> </li>
</ol> </ol>
EXPECTED EXPECTED

View File

@@ -512,12 +512,12 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase
<<~STR.chomp, <<~STR.chomp,
h2. Heading 2 h2. Heading 2
<pre><code class=\"ruby\"> <pre><code class="ruby">
def foo def foo
end end
</code></pre> </code></pre>
<pre><code><pre><code class=\"ruby\"> <pre><code><pre><code class="ruby">
Place your code here. Place your code here.
</code></pre> </code></pre>
</code></pre> </code></pre>
@@ -693,7 +693,7 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase
fn1. This is the foot note fn1. This is the foot note
STR STR
expected = <<~EXPECTED expected = <<~EXPECTED
<p>This is some text<sup><a href=\"#fn1\">1</a></sup>.</p> <p>This is some text<sup><a href="#fn1">1</a></sup>.</p>
<p id="fn1" class="footnote"><sup>1</sup> This is the foot note</p> <p id="fn1" class="footnote"><sup>1</sup> This is the foot note</p>
EXPECTED EXPECTED
assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '') assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '')