Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

Commit

Permalink
Fix to run under Ruby 2.6
Browse files Browse the repository at this point in the history
And add as a requirement
  • Loading branch information
macournoyer committed Apr 13, 2021
1 parent c79bff9 commit e51e6ff
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: theme-check
type: ruby

up:
- ruby: 2.7.1
- ruby: 2.6.6
- bundler

commands:
Expand Down
8 changes: 6 additions & 2 deletions lib/theme_check/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ def enabled_checks

options_for_check = options.transform_keys(&:to_sym)
options_for_check.delete(:enabled)
check = check_class.new(**options_for_check)
check = if options_for_check.empty?
check_class.new
else
check_class.new(**options_for_check)
end
check.options = options_for_check
check
end.compact
Expand All @@ -104,7 +108,7 @@ def ignored_patterns
private

def check_name?(name)
name.start_with?(/[A-Z]/)
name.to_s.start_with?(/[A-Z]/)
end

def validate_configuration(configuration, default_configuration = self.class.default, parent_keys = [])
Expand Down
2 changes: 1 addition & 1 deletion lib/theme_check/parsing_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def outside_of_strings(markup)
scanner = StringScanner.new(markup)

while scanner.scan(/.*?("|')/)
yield scanner.matched[..-2]
yield scanner.matched[0..-2]
# Skip to the end of the string
scanner.skip_until(scanner.matched[-1] == "'" ? /[^\\]'/ : /[^\\]"/)
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def initialize
end

def respond_to?(method)
method.start_with?("on_") || method.start_with?("after_") || super
method.to_s.start_with?("on_") || method.to_s.start_with?("after_") || super
end

def method_missing(method, node)
Expand Down
2 changes: 2 additions & 0 deletions theme-check.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/Shopify/theme-check"
spec.license = "MIT"

spec.required_ruby_version = ">= 2.6"

spec.metadata['allowed_push_host'] = 'https://rubygems.org'

spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
Expand Down

0 comments on commit e51e6ff

Please sign in to comment.