# ********** Copyright Viacom, Inc. Apache 2.0 ********** module RokuBuilder class LineInspector def initialize(config:, raf:, inspector_config:, indent_config:) @config = config @raf_inspector = raf @inspector_config = inspector_config @indent_config = indent_config end def run(file_path) @warnings = [] File.open(file_path) do |file| in_xml_comment = false indent_inspector = IndentationInspector.new(rules: @indent_config, path: file_path) if @indent_config file.readlines.each_with_index do |line, line_number| indent_inspector.check_line(line: line, number: line_number) if indent_inspector full_line = line.dup line = line.partition("'").first if file_path.end_with?(".brs") if file_path.end_with?(".xml") if in_xml_comment if line.gsub!(/.*-->/, "") in_xml_comment = false else line = "" end end line.gsub!(//, "") in_xml_comment = true if line.gsub!(/