Module: PowerApi::GeneratorHelper::RubocopHelper

Extended by:
ActiveSupport::Concern
Included in:
PowerApi::GeneratorHelpers
Defined in:
lib/power_api/generator_helper/rubocop_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_ruby_file(path) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/power_api/generator_helper/rubocop_helper.rb', line 4

def format_ruby_file(path)
  return unless File.exist?(path)

  options, paths = RuboCop::Options.new.parse(["-a", "-fa", path])
  runner = RuboCop::Runner.new(options, RuboCop::ConfigStore.new)
  runner.run(paths)
end