Sha256: 46d8c81467509e6af01aa877a6826f85d1769e49333e78a74709ec4585b7c128
Contents?: true
Size: 1017 Bytes
Versions: 3
Compression:
Stored size: 1017 Bytes
Contents
# frozen_string_literal: true module ThemeCheck class Analyzer attr_reader :offenses def initialize(theme, checks = Check.all.map(&:new)) @theme = theme @offenses = [] @liquid_checks = Checks.new @json_checks = Checks.new checks.each do |check| check.theme = @theme check.offenses = @offenses case check when LiquidCheck @liquid_checks << check when JsonCheck @json_checks << check end end @visitor = Visitor.new(@liquid_checks) end def analyze_theme @offenses.clear @theme.liquid.each { |template| @visitor.visit_template(template) } @theme.json.each { |json_file| @json_checks.call(:on_file, json_file) } @liquid_checks.call(:on_end) @json_checks.call(:on_end) @offenses end def analyze_file(path) path = Pathname.new(path) analyze_theme @offenses.reject! { |offense| offense.template.path != path } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
theme-check-0.1.2 | lib/theme_check/analyzer.rb |
theme-check-0.1.1 | lib/theme_check/analyzer.rb |
theme-check-0.1.0 | lib/theme_check/analyzer.rb |