class SyntaxTree::CLI::Check

An action of the CLI that ensures that the filepath is formatted as expected.

Public Instance Methods

failure() click to toggle source
# File lib/syntax_tree/cli.rb, line 152
def failure
  warn("The listed files did not match the expected format.")
end
run(item) click to toggle source
# File lib/syntax_tree/cli.rb, line 133
def run(item)
  source = item.source
  formatted =
    item.handler.format(
      source,
      options.print_width,
      options: options.formatter_options
    )

  raise UnformattedError if source != formatted
rescue StandardError
  warn("[#{Color.yellow("warn")}] #{item.filepath}")
  raise
end
success() click to toggle source
# File lib/syntax_tree/cli.rb, line 148
def success
  puts("All files matched expected format.")
end