mirror of
https://github.com/kemko/liquid.git
synced 2026-01-03 08:45:42 +03:00
Compare commits
7 Commits
liquid-usa
...
simplify_f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3c6a523b5 | ||
|
|
c34aba4d1a | ||
|
|
8933044cb5 | ||
|
|
ba0edc661d | ||
|
|
c06a325b3b | ||
|
|
6590815b00 | ||
|
|
d1deb89085 |
File diff suppressed because it is too large
Load Diff
122
.rubocop.yml
122
.rubocop.yml
@@ -1,6 +1,6 @@
|
|||||||
inherit_from:
|
inherit_from:
|
||||||
- https://shopify.github.io/ruby-style-guide/rubocop.yml
|
|
||||||
- .rubocop_todo.yml
|
- .rubocop_todo.yml
|
||||||
|
- ./.rubocop_todo.yml
|
||||||
|
|
||||||
require: rubocop-performance
|
require: rubocop-performance
|
||||||
|
|
||||||
@@ -9,8 +9,124 @@ Performance:
|
|||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
|
- 'performance/shopify/*'
|
||||||
- 'vendor/bundle/**/*'
|
- 'vendor/bundle/**/*'
|
||||||
|
- 'pkg/**'
|
||||||
|
|
||||||
|
Metrics/BlockNesting:
|
||||||
|
Max: 3
|
||||||
|
|
||||||
|
Metrics/ModuleLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Metrics/ClassLength:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/AssignmentInCondition:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/AmbiguousOperator:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/AmbiguousRegexpLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/ParenthesesAsGroupedExpression:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Lint/UnusedBlockArgument:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/EndAlignment:
|
||||||
|
EnforcedStyleAlignWith: variable
|
||||||
|
|
||||||
|
Lint/UnusedMethodArgument:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SingleLineBlockParams:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/DoubleNegation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/StringLiteralsInInterpolation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/AndOr:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SignalException:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/StringLiterals:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/BracesAroundHashParameters:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/NumericLiterals:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/SpaceInsideArrayLiteralBrackets:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/SpaceBeforeBlockBraces:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/Documentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassAndModuleChildren:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrailingCommaInArrayLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrailingCommaInHashLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/FormatString:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/AlignParameters:
|
||||||
|
EnforcedStyle: with_fixed_indentation
|
||||||
|
|
||||||
|
Layout/MultilineOperationIndentation:
|
||||||
|
EnforcedStyle: indented
|
||||||
|
|
||||||
|
Style/IfUnlessModifier:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RaiseArgs:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/PreferredHashMethods:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/RegexpLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/SymbolLiteral:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Naming/ConstantName:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Layout/CaseIndentation:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/ClassVars:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/PerlBackrefs:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
Style/TrivialAccessors:
|
||||||
|
AllowPredicates: true
|
||||||
|
|
||||||
|
Style/WordArray:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
Naming/MethodName:
|
Naming/MethodName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'example/server/liquid_servlet.rb'
|
- 'example/server/liquid_servlet.rb'
|
||||||
|
|||||||
@@ -1,12 +1,34 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2019-08-29 12:16:25 +1000 using RuboCop version 0.74.0.
|
# on 2019-08-29 00:43:36 +1000 using RuboCop version 0.74.0.
|
||||||
# The point is for the user to remove these configuration records
|
# The point is for the user to remove these configuration records
|
||||||
# one by one as the offenses are removed from the code base.
|
# one by one as the offenses are removed from the code base.
|
||||||
# Note that changes in the inspected code, or installation of new
|
# Note that changes in the inspected code, or installation of new
|
||||||
# versions of RuboCop, may require this file to be generated again.
|
# versions of RuboCop, may require this file to be generated again.
|
||||||
|
|
||||||
# Offense count: 13
|
# Offense count: 1
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
||||||
|
# Include: **/*.gemspec
|
||||||
|
Gemspec/OrderedDependencies:
|
||||||
|
Exclude:
|
||||||
|
- 'liquid.gemspec'
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# Configuration parameters: Include.
|
||||||
|
# Include: **/*.gemspec,
|
||||||
|
Gemspec/RequiredRubyVersion:
|
||||||
|
Exclude:
|
||||||
|
- 'liquid.gemspec'
|
||||||
|
|
||||||
|
# Offense count: 124
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||||
|
# SupportedStyles: with_first_argument, with_fixed_indentation
|
||||||
|
Layout/AlignArguments:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 7
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||||
# SupportedHashRocketStyles: key, separator, table
|
# SupportedHashRocketStyles: key, separator, table
|
||||||
@@ -16,17 +38,32 @@ Layout/AlignHash:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/condition.rb'
|
- 'lib/liquid/condition.rb'
|
||||||
- 'lib/liquid/expression.rb'
|
- 'lib/liquid/expression.rb'
|
||||||
- 'performance/shopify/comment_form.rb'
|
|
||||||
- 'performance/shopify/database.rb'
|
|
||||||
- 'performance/shopify/paginate.rb'
|
|
||||||
- 'test/unit/context_unit_test.rb'
|
- 'test/unit/context_unit_test.rb'
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 6
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
|
Layout/ClosingHeredocIndentation:
|
||||||
Layout/ExtraSpacing:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'performance/shopify/paginate.rb'
|
- 'test/integration/tags/for_tag_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 27
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Layout/EmptyLineAfterGuardClause:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/block.rb'
|
||||||
|
- 'lib/liquid/block_body.rb'
|
||||||
|
- 'lib/liquid/context.rb'
|
||||||
|
- 'lib/liquid/drop.rb'
|
||||||
|
- 'lib/liquid/lexer.rb'
|
||||||
|
- 'lib/liquid/parser.rb'
|
||||||
|
- 'lib/liquid/standardfilters.rb'
|
||||||
|
- 'lib/liquid/strainer.rb'
|
||||||
|
- 'lib/liquid/tags/for.rb'
|
||||||
|
- 'lib/liquid/tags/if.rb'
|
||||||
|
- 'lib/liquid/tags/include.rb'
|
||||||
|
- 'lib/liquid/utils.rb'
|
||||||
|
- 'lib/liquid/variable.rb'
|
||||||
|
- 'lib/liquid/variable_lookup.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -46,61 +83,12 @@ Layout/MultilineMethodCallBraceLayout:
|
|||||||
- 'test/integration/error_handling_test.rb'
|
- 'test/integration/error_handling_test.rb'
|
||||||
- 'test/unit/strainer_unit_test.rb'
|
- 'test/unit/strainer_unit_test.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowForAlignment.
|
# Configuration parameters: AllowForAlignment.
|
||||||
Layout/SpaceAroundOperators:
|
Layout/SpaceAroundOperators:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/condition.rb'
|
- 'lib/liquid/condition.rb'
|
||||||
- 'performance/shopify/paginate.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
|
|
||||||
# SupportedStyles: space, no_space
|
|
||||||
# SupportedStylesForEmptyBraces: space, no_space
|
|
||||||
Layout/SpaceBeforeBlockBraces:
|
|
||||||
Exclude:
|
|
||||||
- 'example/server/server.rb'
|
|
||||||
- 'lib/liquid/variable.rb'
|
|
||||||
- 'test/integration/drop_test.rb'
|
|
||||||
- 'test/integration/standard_filter_test.rb'
|
|
||||||
- 'test/integration/tags/if_else_tag_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 19
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets.
|
|
||||||
# SupportedStyles: space, no_space, compact
|
|
||||||
# SupportedStylesForEmptyBrackets: space, no_space
|
|
||||||
Layout/SpaceInsideArrayLiteralBrackets:
|
|
||||||
Exclude:
|
|
||||||
- 'test/integration/drop_test.rb'
|
|
||||||
- 'test/integration/standard_filter_test.rb'
|
|
||||||
- 'test/integration/tags/for_tag_test.rb'
|
|
||||||
- 'test/integration/tags/include_tag_test.rb'
|
|
||||||
- 'test/integration/tags/standard_tag_test.rb'
|
|
||||||
- 'test/unit/context_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Lint/AmbiguousOperator:
|
|
||||||
Exclude:
|
|
||||||
- 'test/unit/condition_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 16
|
|
||||||
# Configuration parameters: AllowSafeAssignment.
|
|
||||||
Lint/AssignmentInCondition:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/liquid/block_body.rb'
|
|
||||||
- 'lib/liquid/lexer.rb'
|
|
||||||
- 'lib/liquid/standardfilters.rb'
|
|
||||||
- 'lib/liquid/tags/for.rb'
|
|
||||||
- 'lib/liquid/tags/if.rb'
|
|
||||||
- 'lib/liquid/tags/include.rb'
|
|
||||||
- 'lib/liquid/tags/raw.rb'
|
|
||||||
- 'lib/liquid/variable.rb'
|
|
||||||
- 'performance/profile.rb'
|
|
||||||
- 'test/test_helper.rb'
|
|
||||||
- 'test/unit/tokenizer_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -110,133 +98,87 @@ Lint/InheritException:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/interrupts.rb'
|
- 'lib/liquid/interrupts.rb'
|
||||||
|
|
||||||
# Offense count: 10
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
|
|
||||||
Lint/UnusedBlockArgument:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/liquid/condition.rb'
|
|
||||||
- 'lib/liquid/context.rb'
|
|
||||||
- 'lib/liquid/document.rb'
|
|
||||||
- 'lib/liquid/parse_context.rb'
|
|
||||||
- 'lib/liquid/template.rb'
|
|
||||||
- 'performance/shopify/json_filter.rb'
|
|
||||||
- 'test/integration/filter_test.rb'
|
|
||||||
- 'test/integration/render_profiling_test.rb'
|
|
||||||
- 'test/integration/variable_test.rb'
|
|
||||||
- 'test/unit/condition_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 12
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
|
|
||||||
Lint/UnusedMethodArgument:
|
|
||||||
Exclude:
|
|
||||||
- 'example/server/liquid_servlet.rb'
|
|
||||||
- 'test/integration/blank_test.rb'
|
|
||||||
- 'test/integration/error_handling_test.rb'
|
|
||||||
- 'test/integration/filter_test.rb'
|
|
||||||
- 'test/integration/output_test.rb'
|
|
||||||
- 'test/integration/standard_filter_test.rb'
|
|
||||||
- 'test/integration/tags/include_tag_test.rb'
|
|
||||||
- 'test/unit/strainer_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
Lint/UselessAssignment:
|
|
||||||
Exclude:
|
|
||||||
- 'performance/shopify/database.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
# Configuration parameters: CheckForMethodsWithNoSideEffects.
|
||||||
Lint/Void:
|
Lint/Void:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/parse_context.rb'
|
- 'lib/liquid/parse_context.rb'
|
||||||
|
|
||||||
# Offense count: 95
|
# Offense count: 53
|
||||||
# Cop supports --auto-correct.
|
Metrics/AbcSize:
|
||||||
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
Max: 56
|
||||||
# URISchemes: http, https
|
|
||||||
Metrics/LineLength:
|
|
||||||
Max: 294
|
|
||||||
|
|
||||||
# Offense count: 44
|
# Offense count: 12
|
||||||
Naming/ConstantName:
|
Metrics/CyclomaticComplexity:
|
||||||
|
Max: 13
|
||||||
|
|
||||||
|
# Offense count: 118
|
||||||
|
# Configuration parameters: CountComments, ExcludedMethods.
|
||||||
|
Metrics/MethodLength:
|
||||||
|
Max: 38
|
||||||
|
|
||||||
|
# Offense count: 9
|
||||||
|
Metrics/PerceivedComplexity:
|
||||||
|
Max: 11
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: PreferredName.
|
||||||
|
Naming/RescuedExceptionsVariableName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid.rb'
|
- 'lib/liquid/context.rb'
|
||||||
- 'lib/liquid/block_body.rb'
|
|
||||||
- 'lib/liquid/tags/assign.rb'
|
# Offense count: 20
|
||||||
- 'lib/liquid/tags/capture.rb'
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
||||||
- 'lib/liquid/tags/case.rb'
|
# AllowedNames: io, id, to, by, on, in, at, ip, db
|
||||||
- 'lib/liquid/tags/cycle.rb'
|
Naming/UncommunicativeMethodParamName:
|
||||||
- 'lib/liquid/tags/for.rb'
|
Exclude:
|
||||||
|
- 'example/server/example_servlet.rb'
|
||||||
|
- 'lib/liquid/condition.rb'
|
||||||
|
- 'lib/liquid/context.rb'
|
||||||
|
- 'lib/liquid/standardfilters.rb'
|
||||||
- 'lib/liquid/tags/if.rb'
|
- 'lib/liquid/tags/if.rb'
|
||||||
- 'lib/liquid/tags/include.rb'
|
|
||||||
- 'lib/liquid/tags/raw.rb'
|
|
||||||
- 'lib/liquid/tags/table_row.rb'
|
|
||||||
- 'lib/liquid/variable.rb'
|
- 'lib/liquid/variable.rb'
|
||||||
- 'performance/shopify/comment_form.rb'
|
|
||||||
- 'performance/shopify/paginate.rb'
|
|
||||||
- 'test/integration/tags/include_tag_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Configuration parameters: .
|
|
||||||
# SupportedStyles: snake_case, camelCase
|
|
||||||
Naming/MethodName:
|
|
||||||
EnforcedStyle: snake_case
|
|
||||||
|
|
||||||
# Offense count: 3
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: always, conditionals
|
|
||||||
Style/AndOr:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/liquid/i18n.rb'
|
|
||||||
- 'lib/liquid/tags/table_row.rb'
|
|
||||||
- 'lib/liquid/tokenizer.rb'
|
|
||||||
|
|
||||||
# Offense count: 40
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: braces, no_braces, context_dependent
|
|
||||||
Style/BracesAroundHashParameters:
|
|
||||||
Exclude:
|
|
||||||
- 'test/integration/error_handling_test.rb'
|
|
||||||
- 'test/integration/filter_test.rb'
|
- 'test/integration/filter_test.rb'
|
||||||
- 'test/integration/render_profiling_test.rb'
|
|
||||||
- 'test/integration/standard_filter_test.rb'
|
- 'test/integration/standard_filter_test.rb'
|
||||||
- 'test/integration/tags/echo_test.rb'
|
|
||||||
- 'test/integration/tags/increment_tag_test.rb'
|
|
||||||
- 'test/integration/tags/standard_tag_test.rb'
|
|
||||||
- 'test/integration/template_test.rb'
|
- 'test/integration/template_test.rb'
|
||||||
- 'test/unit/condition_unit_test.rb'
|
- 'test/unit/condition_unit_test.rb'
|
||||||
- 'test/unit/context_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
Style/ClassVars:
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: inline, group
|
||||||
|
Style/AccessModifierDeclarations:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/condition.rb'
|
- 'lib/liquid/block_body.rb'
|
||||||
- 'lib/liquid/strainer.rb'
|
- 'lib/liquid/tag.rb'
|
||||||
- 'lib/liquid/template.rb'
|
- 'lib/liquid/tags/include.rb'
|
||||||
|
- 'test/unit/strainer_unit_test.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 10
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: prefer_alias, prefer_alias_method
|
||||||
|
Style/Alias:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/drop.rb'
|
||||||
|
- 'lib/liquid/i18n.rb'
|
||||||
|
- 'lib/liquid/profiler/hooks.rb'
|
||||||
|
- 'lib/liquid/standardfilters.rb'
|
||||||
|
- 'lib/liquid/tag.rb'
|
||||||
|
- 'lib/liquid/tags/include.rb'
|
||||||
|
- 'lib/liquid/variable.rb'
|
||||||
|
|
||||||
|
# Offense count: 22
|
||||||
|
Style/CommentedKeyword:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions.
|
||||||
# SupportedStyles: assign_to_condition, assign_inside_condition
|
# SupportedStyles: assign_to_condition, assign_inside_condition
|
||||||
Style/ConditionalAssignment:
|
Style/ConditionalAssignment:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/errors.rb'
|
- 'lib/liquid/errors.rb'
|
||||||
- 'performance/shopify/shop_filter.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
|
||||||
# Configuration parameters: AllowCoercion.
|
|
||||||
Style/DateTime:
|
|
||||||
Exclude:
|
|
||||||
- 'test/unit/context_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
Style/EachWithObject:
|
|
||||||
Exclude:
|
|
||||||
- 'performance/shopify/database.rb'
|
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -244,50 +186,71 @@ Style/EmptyCaseCondition:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/lexer.rb'
|
- 'lib/liquid/lexer.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 5
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: each, for
|
# SupportedStyles: compact, expanded
|
||||||
Style/For:
|
Style/EmptyMethod:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'performance/shopify/shop_filter.rb'
|
- 'lib/liquid/tag.rb'
|
||||||
|
- 'lib/liquid/tags/comment.rb'
|
||||||
|
- 'lib/liquid/tags/include.rb'
|
||||||
|
- 'test/integration/tags/include_tag_test.rb'
|
||||||
|
- 'test/unit/context_unit_test.rb'
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
Style/Encoding:
|
||||||
# SupportedStyles: format, sprintf, percent
|
Exclude:
|
||||||
Style/FormatString:
|
- 'lib/liquid/version.rb'
|
||||||
|
- 'liquid.gemspec'
|
||||||
|
- 'test/integration/standard_filter_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 2
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Style/ExpandPathArguments:
|
||||||
|
Exclude:
|
||||||
|
- 'Rakefile'
|
||||||
|
- 'liquid.gemspec'
|
||||||
|
|
||||||
|
# Offense count: 7
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: annotated, template, unannotated
|
||||||
|
Style/FormatStringToken:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'example/server/example_servlet.rb'
|
|
||||||
- 'performance/shopify/money_filter.rb'
|
|
||||||
- 'performance/shopify/weight_filter.rb'
|
|
||||||
- 'test/integration/filter_test.rb'
|
- 'test/integration/filter_test.rb'
|
||||||
- 'test/integration/hash_ordering_test.rb'
|
- 'test/integration/hash_ordering_test.rb'
|
||||||
|
|
||||||
# Offense count: 115
|
# Offense count: 106
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: always, never
|
# SupportedStyles: always, never
|
||||||
Style/FrozenStringLiteralComment:
|
Style/FrozenStringLiteralComment:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 30
|
# Offense count: 14
|
||||||
# Cop supports --auto-correct.
|
# Configuration parameters: MinBodyLength.
|
||||||
# Configuration parameters: IgnoreMacros, IgnoredMethods, IncludedMacros, AllowParenthesesInMultilineCall, AllowParenthesesInChaining, AllowParenthesesInCamelCaseMethod, EnforcedStyle.
|
Style/GuardClause:
|
||||||
# SupportedStyles: require_parentheses, omit_parentheses
|
|
||||||
Style/MethodCallWithArgsParentheses:
|
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'Gemfile'
|
- 'lib/liquid/condition.rb'
|
||||||
- 'Rakefile'
|
- 'lib/liquid/lexer.rb'
|
||||||
- 'lib/liquid/block_body.rb'
|
- 'lib/liquid/strainer.rb'
|
||||||
- 'lib/liquid/parser.rb'
|
- 'lib/liquid/tags/assign.rb'
|
||||||
|
- 'lib/liquid/tags/capture.rb'
|
||||||
|
- 'lib/liquid/tags/case.rb'
|
||||||
- 'lib/liquid/tags/for.rb'
|
- 'lib/liquid/tags/for.rb'
|
||||||
- 'liquid.gemspec'
|
- 'lib/liquid/tags/include.rb'
|
||||||
- 'performance/shopify/database.rb'
|
- 'lib/liquid/tags/raw.rb'
|
||||||
- 'performance/shopify/liquid.rb'
|
- 'lib/liquid/tags/table_row.rb'
|
||||||
- 'test/test_helper.rb'
|
- 'lib/liquid/variable.rb'
|
||||||
- 'test/unit/condition_unit_test.rb'
|
- 'test/unit/tokenizer_unit_test.rb'
|
||||||
- 'test/unit/tags/if_tag_unit_test.rb'
|
|
||||||
|
# Offense count: 53
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: literals, strict
|
||||||
|
Style/MutableConstant:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -297,17 +260,29 @@ Style/Next:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/tags/for.rb'
|
- 'lib/liquid/tags/for.rb'
|
||||||
|
|
||||||
# Offense count: 52
|
# Offense count: 13
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/PerlBackrefs:
|
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
||||||
Enabled: false
|
# SupportedStyles: predicate, comparison
|
||||||
|
Style/NumericPredicate:
|
||||||
|
Exclude:
|
||||||
|
- 'spec/**/*'
|
||||||
|
- 'lib/liquid/context.rb'
|
||||||
|
- 'lib/liquid/forloop_drop.rb'
|
||||||
|
- 'lib/liquid/standardfilters.rb'
|
||||||
|
- 'lib/liquid/tablerowloop_drop.rb'
|
||||||
|
- 'test/integration/standard_filter_test.rb'
|
||||||
|
- 'test/integration/template_test.rb'
|
||||||
|
|
||||||
# Offense count: 33
|
# Offense count: 14
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: PreferredDelimiters.
|
||||||
# SupportedStyles: compact, exploded
|
Style/PercentLiteralDelimiters:
|
||||||
Style/RaiseArgs:
|
Exclude:
|
||||||
Enabled: false
|
- 'lib/liquid/tags/if.rb'
|
||||||
|
- 'liquid.gemspec'
|
||||||
|
- 'test/integration/assign_test.rb'
|
||||||
|
- 'test/integration/standard_filter_test.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -315,17 +290,6 @@ Style/RedundantSelf:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/strainer.rb'
|
- 'lib/liquid/strainer.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
|
|
||||||
# SupportedStyles: slashes, percent_r, mixed
|
|
||||||
Style/RegexpLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/liquid/file_system.rb'
|
|
||||||
- 'lib/liquid/standardfilters.rb'
|
|
||||||
- 'performance/shopify/shop_filter.rb'
|
|
||||||
- 'test/unit/condition_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 3
|
# Offense count: 3
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
|
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
|
||||||
@@ -336,31 +300,21 @@ Style/SafeNavigation:
|
|||||||
- 'lib/liquid/strainer.rb'
|
- 'lib/liquid/strainer.rb'
|
||||||
- 'lib/liquid/tokenizer.rb'
|
- 'lib/liquid/tokenizer.rb'
|
||||||
|
|
||||||
# Offense count: 10
|
# Offense count: 9
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowAsExpressionSeparator.
|
# Configuration parameters: AllowAsExpressionSeparator.
|
||||||
Style/Semicolon:
|
Style/Semicolon:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'performance/shopify/database.rb'
|
|
||||||
- 'test/integration/error_handling_test.rb'
|
- 'test/integration/error_handling_test.rb'
|
||||||
- 'test/integration/template_test.rb'
|
- 'test/integration/template_test.rb'
|
||||||
- 'test/unit/context_unit_test.rb'
|
- 'test/unit/context_unit_test.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 7
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: MinSize.
|
||||||
# SupportedStyles: use_perl_names, use_english_names
|
# SupportedStyles: percent, brackets
|
||||||
Style/SpecialGlobalVars:
|
Style/SymbolArray:
|
||||||
Exclude:
|
EnforcedStyle: brackets
|
||||||
- 'performance/shopify/liquid.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle.
|
|
||||||
# SupportedStyles: single_quotes, double_quotes
|
|
||||||
Style/StringLiteralsInInterpolation:
|
|
||||||
Exclude:
|
|
||||||
- 'performance/shopify/tag_filter.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -371,33 +325,6 @@ Style/TernaryParentheses:
|
|||||||
- 'lib/liquid/context.rb'
|
- 'lib/liquid/context.rb'
|
||||||
- 'lib/liquid/utils.rb'
|
- 'lib/liquid/utils.rb'
|
||||||
|
|
||||||
# Offense count: 21
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyleForMultiline.
|
|
||||||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
||||||
Style/TrailingCommaInArrayLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/liquid/parse_tree_visitor.rb'
|
|
||||||
- 'lib/liquid/tags/include.rb'
|
|
||||||
- 'test/integration/parse_tree_visitor_test.rb'
|
|
||||||
- 'test/integration/standard_filter_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyleForMultiline.
|
|
||||||
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
||||||
Style/TrailingCommaInHashLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'lib/liquid/condition.rb'
|
|
||||||
- 'lib/liquid/lexer.rb'
|
|
||||||
- 'lib/liquid/standardfilters.rb'
|
|
||||||
- 'performance/shopify/comment_form.rb'
|
|
||||||
- 'performance/shopify/database.rb'
|
|
||||||
- 'performance/shopify/paginate.rb'
|
|
||||||
- 'performance/theme_runner.rb'
|
|
||||||
- 'test/integration/output_test.rb'
|
|
||||||
- 'test/unit/context_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/UnneededPercentQ:
|
Style/UnneededPercentQ:
|
||||||
@@ -409,3 +336,10 @@ Style/UnneededPercentQ:
|
|||||||
Style/WhileUntilModifier:
|
Style/WhileUntilModifier:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/tags/case.rb'
|
- 'lib/liquid/tags/case.rb'
|
||||||
|
|
||||||
|
# Offense count: 665
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||||
|
# URISchemes: http, https
|
||||||
|
Metrics/LineLength:
|
||||||
|
Max: 294
|
||||||
|
|||||||
2
Gemfile
2
Gemfile
@@ -20,6 +20,6 @@ group :test do
|
|||||||
gem 'rubocop-performance', require: false
|
gem 'rubocop-performance', require: false
|
||||||
|
|
||||||
platform :mri, :truffleruby do
|
platform :mri, :truffleruby do
|
||||||
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'master'
|
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'liquid-tag'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -106,9 +106,3 @@ template = Liquid::Template.parse("{{x}} {{y}}")
|
|||||||
template.render!({ 'x' => 1}, { strict_variables: true })
|
template.render!({ 'x' => 1}, { strict_variables: true })
|
||||||
#=> Liquid::UndefinedVariable: Liquid error: undefined variable y
|
#=> Liquid::UndefinedVariable: Liquid error: undefined variable y
|
||||||
```
|
```
|
||||||
|
|
||||||
### Usage tracking
|
|
||||||
|
|
||||||
To help track usages of a feature or code path in production, we have released opt-in usage tracking. To enable this, we provide an empty `Liquid:: Usage.increment` method which you can customize to your needs. The feature is well suited to https://github.com/Shopify/statsd-instrument. However, the choice of implementation is up to you.
|
|
||||||
|
|
||||||
Once you have enabled usage tracking, we recommend reporting any events through Github Issues that your system may be logging. It is highly likely this event has been added to consider deprecating or improving code specific to this event, so please raise any concerns.
|
|
||||||
@@ -75,7 +75,6 @@ require 'liquid/utils'
|
|||||||
require 'liquid/tokenizer'
|
require 'liquid/tokenizer'
|
||||||
require 'liquid/parse_context'
|
require 'liquid/parse_context'
|
||||||
require 'liquid/partial_cache'
|
require 'liquid/partial_cache'
|
||||||
require 'liquid/usage'
|
|
||||||
|
|
||||||
# Load all the tags of the standard library
|
# Load all the tags of the standard library
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -15,16 +15,16 @@ module Liquid
|
|||||||
attr_reader :scopes, :errors, :registers, :environments, :resource_limits, :static_registers, :static_environments
|
attr_reader :scopes, :errors, :registers, :environments, :resource_limits, :static_registers, :static_environments
|
||||||
attr_accessor :exception_renderer, :template_name, :partial, :global_filter, :strict_variables, :strict_filters
|
attr_accessor :exception_renderer, :template_name, :partial, :global_filter, :strict_variables, :strict_filters
|
||||||
|
|
||||||
|
BLANK_SCOPE = {}
|
||||||
|
|
||||||
# rubocop:disable Metrics/ParameterLists
|
# rubocop:disable Metrics/ParameterLists
|
||||||
def self.build(environments: {}, outer_scope: {}, registers: {}, rethrow_errors: false, resource_limits: nil, static_registers: {}, static_environments: {})
|
def self.build(environments: {}, outer_scope: {}, registers: {}, rethrow_errors: false, resource_limits: nil, static_registers: {}, static_environments: {})
|
||||||
new(environments, outer_scope, registers, rethrow_errors, resource_limits, static_registers, static_environments)
|
new(environments, outer_scope, registers, rethrow_errors, resource_limits, static_registers, static_environments)
|
||||||
end
|
end
|
||||||
|
|
||||||
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = nil, static_registers = {}, static_environments = {})
|
def initialize(environments = {}, outer_scope = {}, registers = {}, rethrow_errors = false, resource_limits = nil, static_registers = {}, static_environments = {})
|
||||||
@environments = [environments]
|
@environments = [environments].flatten
|
||||||
@environments.flatten!
|
@static_environments = [static_environments].flatten.map(&:freeze).freeze
|
||||||
|
|
||||||
@static_environments = [static_environments].flat_map(&:freeze).freeze
|
|
||||||
@scopes = [(outer_scope || {})]
|
@scopes = [(outer_scope || {})]
|
||||||
@registers = registers
|
@registers = registers
|
||||||
@static_registers = static_registers.freeze
|
@static_registers = static_registers.freeze
|
||||||
@@ -193,15 +193,12 @@ module Liquid
|
|||||||
def find_variable(key, raise_on_not_found: true)
|
def find_variable(key, raise_on_not_found: true)
|
||||||
# This was changed from find() to find_index() because this is a very hot
|
# This was changed from find() to find_index() because this is a very hot
|
||||||
# path and find_index() is optimized in MRI to reduce object allocation
|
# path and find_index() is optimized in MRI to reduce object allocation
|
||||||
index = @scopes.find_index { |s| s.key?(key) }
|
scope = (index = @scopes.find_index { |s| s.key?(key) }) && @scopes[index]
|
||||||
|
scope ||= (index = @environments.find_index { |s| s.key?(key) || s.default_proc }) && @environments[index]
|
||||||
|
scope ||= (index = @static_environments.find_index { |s| s.key?(key) }) && @static_environments[index]
|
||||||
|
scope ||= BLANK_SCOPE
|
||||||
|
|
||||||
variable = if index
|
variable = lookup_and_evaluate(scope, key, raise_on_not_found: raise_on_not_found).to_liquid
|
||||||
lookup_and_evaluate(@scopes[index], key, raise_on_not_found: raise_on_not_found)
|
|
||||||
else
|
|
||||||
try_variable_find_in_environments(key, raise_on_not_found: raise_on_not_found)
|
|
||||||
end
|
|
||||||
|
|
||||||
variable = variable.to_liquid
|
|
||||||
variable.context = self if variable.respond_to?(:context=)
|
variable.context = self if variable.respond_to?(:context=)
|
||||||
|
|
||||||
variable
|
variable
|
||||||
@@ -229,22 +226,6 @@ module Liquid
|
|||||||
|
|
||||||
attr_reader :base_scope_depth
|
attr_reader :base_scope_depth
|
||||||
|
|
||||||
def try_variable_find_in_environments(key, raise_on_not_found:)
|
|
||||||
@environments.each do |environment|
|
|
||||||
found_variable = lookup_and_evaluate(environment, key, raise_on_not_found: raise_on_not_found)
|
|
||||||
if !found_variable.nil? || @strict_variables && raise_on_not_found
|
|
||||||
return found_variable
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@static_environments.each do |environment|
|
|
||||||
found_variable = lookup_and_evaluate(environment, key, raise_on_not_found: raise_on_not_found)
|
|
||||||
if !found_variable.nil? || @strict_variables && raise_on_not_found
|
|
||||||
return found_variable
|
|
||||||
end
|
|
||||||
end
|
|
||||||
nil
|
|
||||||
end
|
|
||||||
|
|
||||||
def check_overflow
|
def check_overflow
|
||||||
raise StackLevelError, "Nesting too deep".freeze if overflow?
|
raise StackLevelError, "Nesting too deep".freeze if overflow?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -421,7 +421,6 @@ module Liquid
|
|||||||
|
|
||||||
def default(input, default_value = ''.freeze)
|
def default(input, default_value = ''.freeze)
|
||||||
if !input || input.respond_to?(:empty?) && input.empty?
|
if !input || input.respond_to?(:empty?) && input.empty?
|
||||||
Usage.increment("default_filter_received_false_value") if input == false # See https://github.com/Shopify/liquid/issues/1127
|
|
||||||
default_value
|
default_value
|
||||||
else
|
else
|
||||||
input
|
input
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
module Liquid
|
module Liquid
|
||||||
class Render < Tag
|
class Render < Tag
|
||||||
SYNTAX = /(#{QuotedString})#{QuotedFragment}*/o
|
Syntax = /(#{QuotedString})#{QuotedFragment}*/o
|
||||||
|
|
||||||
attr_reader :template_name_expr, :attributes
|
attr_reader :template_name_expr, :attributes
|
||||||
|
|
||||||
def initialize(tag_name, markup, options)
|
def initialize(tag_name, markup, options)
|
||||||
super
|
super
|
||||||
|
|
||||||
raise SyntaxError.new(options[:locale].t("errors.syntax.render".freeze)) unless markup =~ SYNTAX
|
raise SyntaxError.new(options[:locale].t("errors.syntax.render".freeze)) unless markup =~ Syntax
|
||||||
|
|
||||||
template_name = $1
|
template_name = $1
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
module Liquid
|
|
||||||
module Usage
|
|
||||||
def self.increment(name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -110,7 +110,7 @@ class RenderTagTest < Minitest::Test
|
|||||||
file_system = StubFileSystem.new('snippet' => 'echo')
|
file_system = StubFileSystem.new('snippet' => 'echo')
|
||||||
assert_equal 'echoecho',
|
assert_equal 'echoecho',
|
||||||
Template.parse('{% render "snippet" %}{% render "snippet" %}')
|
Template.parse('{% render "snippet" %}{% render "snippet" %}')
|
||||||
.render!({}, registers: { file_system: file_system })
|
.render!({}, registers: { file_system: file_system })
|
||||||
assert_equal 1, file_system.file_read_count
|
assert_equal 1, file_system.file_read_count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -86,6 +86,14 @@ class VariableTest < Minitest::Test
|
|||||||
assert_equal "Unknown variable 'test'", e.message
|
assert_equal "Unknown variable 'test'", e.message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_environment_falsy
|
||||||
|
template = Template.parse(%({{ test }}{% assign test = 'bar' %}{{ test }}))
|
||||||
|
template.assigns['test'] = 'foo'
|
||||||
|
assert_equal 'foobar', template.render!
|
||||||
|
assert_equal 'bar', template.render!('test' => nil)
|
||||||
|
assert_equal 'falsebar', template.render!('test' => false)
|
||||||
|
end
|
||||||
|
|
||||||
def test_multiline_variable
|
def test_multiline_variable
|
||||||
assert_equal 'worked', Template.parse("{{\ntest\n}}").render!('test' => 'worked')
|
assert_equal 'worked', Template.parse("{{\ntest\n}}").render!('test' => 'worked')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ class PartialCacheUnitTest < Minitest::Test
|
|||||||
def test_uses_the_file_system_register_if_present
|
def test_uses_the_file_system_register_if_present
|
||||||
context = Liquid::Context.build(
|
context = Liquid::Context.build(
|
||||||
registers: {
|
registers: {
|
||||||
file_system: StubFileSystem.new('my_partial' => 'my partial body'),
|
file_system: StubFileSystem.new('my_partial' => 'my partial body')
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -41,12 +41,12 @@ class PartialCacheUnitTest < Minitest::Test
|
|||||||
)
|
)
|
||||||
context_one = Liquid::Context.build(
|
context_one = Liquid::Context.build(
|
||||||
registers: {
|
registers: {
|
||||||
file_system: shared_file_system,
|
file_system: shared_file_system
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
context_two = Liquid::Context.build(
|
context_two = Liquid::Context.build(
|
||||||
registers: {
|
registers: {
|
||||||
file_system: shared_file_system,
|
file_system: shared_file_system
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user