mirror of
https://github.com/kemko/liquid.git
synced 2026-01-02 00:05:42 +03:00
Compare commits
2 Commits
context_si
...
bump-ruby-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf4e77ab0c | ||
|
|
b16b109a80 |
12
.rubocop.yml
12
.rubocop.yml
@@ -2,9 +2,15 @@ inherit_from:
|
|||||||
- .rubocop_todo.yml
|
- .rubocop_todo.yml
|
||||||
- ./.rubocop_todo.yml
|
- ./.rubocop_todo.yml
|
||||||
|
|
||||||
|
require: rubocop-performance
|
||||||
|
|
||||||
|
Performance:
|
||||||
|
Enabled: true
|
||||||
|
|
||||||
AllCops:
|
AllCops:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'performance/shopify/*'
|
- 'performance/shopify/*'
|
||||||
|
- 'vendor/bundle/**/*'
|
||||||
- 'pkg/**'
|
- 'pkg/**'
|
||||||
|
|
||||||
Metrics/BlockNesting:
|
Metrics/BlockNesting:
|
||||||
@@ -79,9 +85,6 @@ Style/TrailingCommaInArrayLiteral:
|
|||||||
Style/TrailingCommaInHashLiteral:
|
Style/TrailingCommaInHashLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Layout/IndentHash:
|
|
||||||
EnforcedStyle: consistent
|
|
||||||
|
|
||||||
Style/FormatString:
|
Style/FormatString:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
@@ -106,9 +109,6 @@ Style/RegexpLiteral:
|
|||||||
Style/SymbolLiteral:
|
Style/SymbolLiteral:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
Performance/Count:
|
|
||||||
Enabled: false
|
|
||||||
|
|
||||||
Naming/ConstantName:
|
Naming/ConstantName:
|
||||||
Enabled: false
|
Enabled: false
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This configuration was generated by
|
# This configuration was generated by
|
||||||
# `rubocop --auto-gen-config`
|
# `rubocop --auto-gen-config`
|
||||||
# on 2019-04-22 19:11:24 -0400 using RuboCop version 0.53.0.
|
# on 2019-08-27 22:42:50 +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
|
||||||
@@ -8,16 +8,67 @@
|
|||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
|
# Configuration parameters: TreatCommentsAsGroupSeparators, Include.
|
||||||
# Include: **/*.gemspec
|
# Include: **/*.gemspec
|
||||||
Gemspec/OrderedDependencies:
|
Gemspec/OrderedDependencies:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'liquid.gemspec'
|
- '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.
|
||||||
|
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
|
||||||
|
# SupportedHashRocketStyles: key, separator, table
|
||||||
|
# SupportedColonStyles: key, separator, table
|
||||||
|
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
|
||||||
|
Layout/AlignHash:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/condition.rb'
|
||||||
|
- 'lib/liquid/expression.rb'
|
||||||
|
- 'test/unit/context_unit_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 6
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
Layout/ClosingHeredocIndentation:
|
||||||
|
Exclude:
|
||||||
|
- 'test/integration/tags/for_tag_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 25
|
||||||
|
# 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.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
# SupportedStyles: squiggly, active_support, powerpack, unindent
|
||||||
Layout/IndentHeredoc:
|
Layout/IndentHeredoc:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'test/integration/tags/for_tag_test.rb'
|
- 'test/integration/tags/for_tag_test.rb'
|
||||||
@@ -32,6 +83,13 @@ 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: 1
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: AllowForAlignment.
|
||||||
|
Layout/SpaceAroundOperators:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/condition.rb'
|
||||||
|
|
||||||
# Offense count: 2
|
# Offense count: 2
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
@@ -46,7 +104,7 @@ Lint/Void:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/parse_context.rb'
|
- 'lib/liquid/parse_context.rb'
|
||||||
|
|
||||||
# Offense count: 53
|
# Offense count: 52
|
||||||
Metrics/AbcSize:
|
Metrics/AbcSize:
|
||||||
Max: 56
|
Max: 56
|
||||||
|
|
||||||
@@ -54,27 +112,25 @@ Metrics/AbcSize:
|
|||||||
Metrics/CyclomaticComplexity:
|
Metrics/CyclomaticComplexity:
|
||||||
Max: 13
|
Max: 13
|
||||||
|
|
||||||
# Offense count: 112
|
# Offense count: 114
|
||||||
# Configuration parameters: CountComments.
|
# Configuration parameters: CountComments, ExcludedMethods.
|
||||||
Metrics/MethodLength:
|
Metrics/MethodLength:
|
||||||
Max: 38
|
Max: 38
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 9
|
||||||
Metrics/PerceivedComplexity:
|
Metrics/PerceivedComplexity:
|
||||||
Max: 11
|
Max: 11
|
||||||
|
|
||||||
# Offense count: 52
|
# Offense count: 1
|
||||||
# Configuration parameters: Blacklist.
|
# Cop supports --auto-correct.
|
||||||
# Blacklist: END, (?-mix:EO[A-Z]{1})
|
# Configuration parameters: PreferredName.
|
||||||
Naming/HeredocDelimiterNaming:
|
Naming/RescuedExceptionsVariableName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'test/integration/assign_test.rb'
|
- 'lib/liquid/context.rb'
|
||||||
- 'test/integration/capture_test.rb'
|
|
||||||
- 'test/integration/trim_mode_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 23
|
# Offense count: 20
|
||||||
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
|
||||||
# AllowedNames: io, id
|
# AllowedNames: io, id, to, by, on, in, at, ip, db
|
||||||
Naming/UncommunicativeMethodParamName:
|
Naming/UncommunicativeMethodParamName:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'example/server/example_servlet.rb'
|
- 'example/server/example_servlet.rb'
|
||||||
@@ -82,15 +138,22 @@ Naming/UncommunicativeMethodParamName:
|
|||||||
- 'lib/liquid/context.rb'
|
- 'lib/liquid/context.rb'
|
||||||
- 'lib/liquid/standardfilters.rb'
|
- 'lib/liquid/standardfilters.rb'
|
||||||
- 'lib/liquid/tags/if.rb'
|
- 'lib/liquid/tags/if.rb'
|
||||||
- 'lib/liquid/utils.rb'
|
|
||||||
- 'lib/liquid/variable.rb'
|
- 'lib/liquid/variable.rb'
|
||||||
- 'test/integration/filter_test.rb'
|
- 'test/integration/filter_test.rb'
|
||||||
- 'test/integration/standard_filter_test.rb'
|
- 'test/integration/standard_filter_test.rb'
|
||||||
- 'test/integration/tags/for_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'
|
||||||
|
|
||||||
# Offense count: 12
|
# Offense count: 3
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: inline, group
|
||||||
|
Style/AccessModifierDeclarations:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/tag.rb'
|
||||||
|
- 'lib/liquid/tags/include.rb'
|
||||||
|
- 'test/unit/strainer_unit_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 10
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: EnforcedStyle.
|
# Configuration parameters: EnforcedStyle.
|
||||||
# SupportedStyles: prefer_alias, prefer_alias_method
|
# SupportedStyles: prefer_alias, prefer_alias_method
|
||||||
@@ -117,15 +180,9 @@ Style/ConditionalAssignment:
|
|||||||
- 'lib/liquid/errors.rb'
|
- 'lib/liquid/errors.rb'
|
||||||
|
|
||||||
# Offense count: 1
|
# Offense count: 1
|
||||||
Style/DateTime:
|
|
||||||
Exclude:
|
|
||||||
- 'test/unit/context_unit_test.rb'
|
|
||||||
|
|
||||||
# Offense count: 2
|
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Style/EmptyCaseCondition:
|
Style/EmptyCaseCondition:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/block_body.rb'
|
|
||||||
- 'lib/liquid/lexer.rb'
|
- 'lib/liquid/lexer.rb'
|
||||||
|
|
||||||
# Offense count: 5
|
# Offense count: 5
|
||||||
@@ -163,6 +220,13 @@ Style/FormatStringToken:
|
|||||||
- 'test/integration/filter_test.rb'
|
- 'test/integration/filter_test.rb'
|
||||||
- 'test/integration/hash_ordering_test.rb'
|
- 'test/integration/hash_ordering_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 103
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: EnforcedStyle.
|
||||||
|
# SupportedStyles: always, never
|
||||||
|
Style/FrozenStringLiteralComment:
|
||||||
|
Enabled: false
|
||||||
|
|
||||||
# Offense count: 14
|
# Offense count: 14
|
||||||
# Configuration parameters: MinBodyLength.
|
# Configuration parameters: MinBodyLength.
|
||||||
Style/GuardClause:
|
Style/GuardClause:
|
||||||
@@ -180,6 +244,13 @@ Style/GuardClause:
|
|||||||
- 'lib/liquid/variable.rb'
|
- 'lib/liquid/variable.rb'
|
||||||
- 'test/unit/tokenizer_unit_test.rb'
|
- 'test/unit/tokenizer_unit_test.rb'
|
||||||
|
|
||||||
|
# Offense count: 52
|
||||||
|
# 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.
|
||||||
# Configuration parameters: EnforcedStyle, MinBodyLength.
|
# Configuration parameters: EnforcedStyle, MinBodyLength.
|
||||||
@@ -188,9 +259,9 @@ Style/Next:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/tags/for.rb'
|
- 'lib/liquid/tags/for.rb'
|
||||||
|
|
||||||
# Offense count: 4
|
# Offense count: 13
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AutoCorrect, EnforcedStyle.
|
# Configuration parameters: AutoCorrect, EnforcedStyle, IgnoredMethods.
|
||||||
# SupportedStyles: predicate, comparison
|
# SupportedStyles: predicate, comparison
|
||||||
Style/NumericPredicate:
|
Style/NumericPredicate:
|
||||||
Exclude:
|
Exclude:
|
||||||
@@ -199,6 +270,8 @@ Style/NumericPredicate:
|
|||||||
- 'lib/liquid/forloop_drop.rb'
|
- 'lib/liquid/forloop_drop.rb'
|
||||||
- 'lib/liquid/standardfilters.rb'
|
- 'lib/liquid/standardfilters.rb'
|
||||||
- 'lib/liquid/tablerowloop_drop.rb'
|
- 'lib/liquid/tablerowloop_drop.rb'
|
||||||
|
- 'test/integration/standard_filter_test.rb'
|
||||||
|
- 'test/integration/template_test.rb'
|
||||||
|
|
||||||
# Offense count: 14
|
# Offense count: 14
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
@@ -216,6 +289,16 @@ Style/RedundantSelf:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/strainer.rb'
|
- 'lib/liquid/strainer.rb'
|
||||||
|
|
||||||
|
# Offense count: 3
|
||||||
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: ConvertCodeThatCanStartToReturnNil, Whitelist.
|
||||||
|
# Whitelist: present?, blank?, presence, try, try!
|
||||||
|
Style/SafeNavigation:
|
||||||
|
Exclude:
|
||||||
|
- 'lib/liquid/drop.rb'
|
||||||
|
- 'lib/liquid/strainer.rb'
|
||||||
|
- 'lib/liquid/tokenizer.rb'
|
||||||
|
|
||||||
# Offense count: 9
|
# Offense count: 9
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
# Configuration parameters: AllowAsExpressionSeparator.
|
# Configuration parameters: AllowAsExpressionSeparator.
|
||||||
@@ -253,8 +336,9 @@ Style/WhileUntilModifier:
|
|||||||
Exclude:
|
Exclude:
|
||||||
- 'lib/liquid/tags/case.rb'
|
- 'lib/liquid/tags/case.rb'
|
||||||
|
|
||||||
# Offense count: 648
|
# Offense count: 650
|
||||||
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
# Cop supports --auto-correct.
|
||||||
|
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
||||||
# URISchemes: http, https
|
# URISchemes: http, https
|
||||||
Metrics/LineLength:
|
Metrics/LineLength:
|
||||||
Max: 294
|
Max: 294
|
||||||
|
|||||||
14
.travis.yml
14
.travis.yml
@@ -1,20 +1,14 @@
|
|||||||
language: ruby
|
language: ruby
|
||||||
|
|
||||||
rvm:
|
rvm:
|
||||||
- 2.1
|
|
||||||
- 2.2
|
|
||||||
- 2.3
|
|
||||||
- 2.4
|
- 2.4
|
||||||
- 2.5
|
- 2.5
|
||||||
- &latest_ruby 2.6
|
- &latest_ruby 2.6
|
||||||
|
- 2.7
|
||||||
- ruby-head
|
- ruby-head
|
||||||
- jruby-head
|
- jruby-head
|
||||||
# - rbx-2
|
- truffleruby
|
||||||
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
packages:
|
|
||||||
- libgmp3-dev
|
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
@@ -24,9 +18,9 @@ matrix:
|
|||||||
allow_failures:
|
allow_failures:
|
||||||
- rvm: ruby-head
|
- rvm: ruby-head
|
||||||
- rvm: jruby-head
|
- rvm: jruby-head
|
||||||
|
- rvm: truffleruby
|
||||||
|
|
||||||
install:
|
cache: bundler
|
||||||
- bundle install
|
|
||||||
|
|
||||||
script: bundle exec rake
|
script: bundle exec rake
|
||||||
|
|
||||||
|
|||||||
7
Gemfile
7
Gemfile
@@ -10,15 +10,16 @@ group :benchmark, :test do
|
|||||||
gem 'memory_profiler'
|
gem 'memory_profiler'
|
||||||
gem 'terminal-table'
|
gem 'terminal-table'
|
||||||
|
|
||||||
install_if -> { RUBY_PLATFORM !~ /mingw|mswin|java/ } do
|
install_if -> { RUBY_PLATFORM !~ /mingw|mswin|java/ && RUBY_ENGINE != 'truffleruby' } do
|
||||||
gem 'stackprof'
|
gem 'stackprof'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
group :test do
|
group :test do
|
||||||
gem 'rubocop', '~> 0.53.0'
|
gem 'rubocop', '~> 0.74.0', require: false
|
||||||
|
gem 'rubocop-performance', require: false
|
||||||
|
|
||||||
platform :mri do
|
platform :mri, :truffleruby do
|
||||||
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'liquid-tag'
|
gem 'liquid-c', github: 'Shopify/liquid-c', ref: 'liquid-tag'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
10
Rakefile
10
Rakefile
@@ -19,8 +19,10 @@ task :warn_test do
|
|||||||
end
|
end
|
||||||
|
|
||||||
task :rubocop do
|
task :rubocop do
|
||||||
require 'rubocop/rake_task'
|
if RUBY_ENGINE == 'ruby'
|
||||||
RuboCop::RakeTask.new
|
require 'rubocop/rake_task'
|
||||||
|
RuboCop::RakeTask.new
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'runs test suite with both strict and lax parsers'
|
desc 'runs test suite with both strict and lax parsers'
|
||||||
@@ -32,8 +34,8 @@ task :test do
|
|||||||
Rake::Task['base_test'].reenable
|
Rake::Task['base_test'].reenable
|
||||||
Rake::Task['base_test'].invoke
|
Rake::Task['base_test'].invoke
|
||||||
|
|
||||||
if RUBY_ENGINE == 'ruby'
|
if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'truffleruby'
|
||||||
ENV['LIQUID-C'] = '1'
|
ENV['LIQUID_C'] = '1'
|
||||||
|
|
||||||
ENV['LIQUID_PARSER_MODE'] = 'lax'
|
ENV['LIQUID_PARSER_MODE'] = 'lax'
|
||||||
Rake::Task['base_test'].reenable
|
Rake::Task['base_test'].reenable
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|||||||
s.license = "MIT"
|
s.license = "MIT"
|
||||||
# s.description = "A secure, non-evaling end user template engine with aesthetic markup."
|
# s.description = "A secure, non-evaling end user template engine with aesthetic markup."
|
||||||
|
|
||||||
s.required_ruby_version = ">= 2.1.0"
|
s.required_ruby_version = ">= 2.4.0"
|
||||||
s.required_rubygems_version = ">= 1.3.7"
|
s.required_rubygems_version = ">= 1.3.7"
|
||||||
|
|
||||||
s.test_files = Dir.glob("{test}/**/*")
|
s.test_files = Dir.glob("{test}/**/*")
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ if env_mode = ENV['LIQUID_PARSER_MODE']
|
|||||||
end
|
end
|
||||||
Liquid::Template.error_mode = mode
|
Liquid::Template.error_mode = mode
|
||||||
|
|
||||||
if ENV['LIQUID-C'] == '1'
|
if ENV['LIQUID_C'] == '1'
|
||||||
puts "-- LIQUID C"
|
puts "-- LIQUID C"
|
||||||
require 'liquid/c'
|
require 'liquid/c'
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user