class SyntaxTree::CLI::Debug
format is not idempotent.
An action of the CLI that formats the source twice to check if the first
def failure
def failure warn("The listed files could not be formatted idempotently.") end
def run(item)
def run(item) handler = item.handler warning = "[#{Color.yellow("warn")}] #{item.filepath}" formatted = handler.format( item.source, options.print_width, options: options.formatter_options ) double_formatted = handler.format( formatted, options.print_width, options: options.formatter_options ) raise NonIdempotentFormatError if formatted != double_formatted rescue StandardError warn(warning) raise end
def success
def success puts("All files can be formatted idempotently.") end