Enabled frozen string literals (#1154)

* Enabled frozen string literals

* Update rubocop config

* Prefer string interpolation in simple cases

Co-Authored-By: Dylan Thacker-Smith <[email protected]>
This commit is contained in:
Mike Angell
2019-09-18 13:19:45 +10:00
committed by GitHub
co-authored by Dylan Thacker-Smith
parent 1dcad34b06
commit 0d26f05bb8
121 changed files with 379 additions and 150 deletions
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class AssignTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class FoobarTag < Liquid::Tag
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class BlockTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class CaptureTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ContextTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class DocumentTest < Minitest::Test
+4 -2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ContextDrop < Liquid::Drop
@@ -31,7 +33,7 @@ class ProductDrop < Liquid::Drop
class CatchallDrop < Liquid::Drop
def liquid_method_missing(method)
'catchall_method: ' << method.to_s
"catchall_method: #{method}"
end
end
@@ -48,7 +50,7 @@ class ProductDrop < Liquid::Drop
end
def user_input
"foo".taint
(+"foo").taint
end
protected
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ErrorHandlingTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
module MoneyFilter
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class HashOrderingTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
module FunnyFilter
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ParsingQuirksTest < Minitest::Test
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class RenderProfilingTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
module SecurityFilter
+1
View File
@@ -1,4 +1,5 @@
# encoding: utf-8
# frozen_string_literal: true
require 'test_helper'
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class BreakTagTest < Minitest::Test
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ContinueTagTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class EchoTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ThingWithValue < Liquid::Drop
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class IfElseTagTest < Minitest::Test
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TestFileSystem
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class IncrementTagTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class LiquidTagTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class RawTagTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class RenderTagTest < Minitest::Test
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class StandardTagTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class StatementsTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TableRowTest < Minitest::Test
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class UnlessElseTagTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
require 'timeout'
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TrimModeTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class VariableTest < Minitest::Test
+1
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
ENV["MT_NO_EXPECTATIONS"] = "1"
require 'minitest/autorun'
+4 -2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class BlockUnitTest < Minitest::Test
@@ -61,7 +63,7 @@ class BlockUnitTest < Minitest::Test
assert_equal 'hello', template.render
buf = ''
buf = +''
output = template.render({}, output: buf)
assert_equal 'hello', output
assert_equal 'hello', buf
@@ -79,7 +81,7 @@ class BlockUnitTest < Minitest::Test
assert_equal 'foohellobar', template.render
buf = ''
buf = +''
output = template.render({}, output: buf)
assert_equal 'foohellobar', output
assert_equal 'foohellobar', buf
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ConditionUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class HundredCentes
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class FileSystemUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class I18nUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class LexerUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ParserUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class PartialCacheUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class RegexpUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class StrainerUnitTest < Minitest::Test
+4 -2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TagUnitTest < Minitest::Test
@@ -31,7 +33,7 @@ class TagUnitTest < Minitest::Test
assert_equal 'hello', template.render
buf = ''
buf = +''
output = template.render({}, output: buf)
assert_equal 'hello', output
assert_equal 'hello', buf
@@ -49,7 +51,7 @@ class TagUnitTest < Minitest::Test
assert_equal 'foohellobar', template.render
buf = ''
buf = +''
output = template.render({}, output: buf)
assert_equal 'foohellobar', output
assert_equal 'foohellobar', buf
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class CaseTagUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class ForTagUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class IfTagUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TemplateUnitTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class TokenizerTest < Minitest::Test
+2
View File
@@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'test_helper'
class VariableUnitTest < Minitest::Test