class ERBLint::Linters::BlankslateApiMigration
def run(processed_source)
def run(processed_source) processed_source.ast.descendants(:erb).each do |erb_node| _, _, code_node = *erb_node code = code_node.children.first.strip next unless code.include?("Primer::BlankslateComponent") # Don't fix custom blankslates next if code.end_with?("do", "|") line = erb_node.loc.source_line indent = line.split("<%=").first.size ast = erb_ast(code) kwargs = ast.arguments.first.arguments.last replacement = build_replacement_blankslate(kwargs, indent) add_offense(processed_source.to_source_range(erb_node.loc), "`Primer::BlankslateComponent` is deprecated. `Primer::Beta::Blankslate` should be used instead", replacement) end end