Sha256: 1925c905c16908bd3472d5074725165e69201c86473701a6668440b9b7efb1f2
Contents?: true
Size: 960 Bytes
Versions: 6
Compression:
Stored size: 960 Bytes
Contents
# frozen_string_literal: true require_relative "./regexes" module Harri module Parser # Given an "unused import" error stanza, parses the involved filename, # module, and unused imports. def self.parse_unused_import_error(lines) first_line = lines[0] remaining_lines = lines.drop 1 file = first_line.match(Harri::Regexes::START_ERROR_REGEX)[1] error = remaining_lines.map(&:strip).join " " redundant_module_match = error.match Harri::Regexes::ENTIRE_MODULE_REDUNDANT_REGEX if redundant_module_match { file: file, module: redundant_module_match[1], imports: [] } else redundant_imports_match = error.match Harri::Regexes::REDUNDANT_IMPORTS_WITHIN_MODULE_REGEX { file: file, module: redundant_imports_match[2], imports: redundant_imports_match[1].split(",").map(&:strip) } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems