class SleepingKingStudios::Tasks::Ci::RuboCopRunner
Service object to run RuboCop as an external process with the specified parameters.
Public Instance Methods
call(env: {})
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/rubocop_runner.rb, line 10 def call env: {}, files: [], options: [], report: true report = 'tmp/ci/rubocop.json' if report && !report.is_a?(String) command = build_command( :env => env, :files => files, :options => options, :report => report ) # end build_command stream_process(command) report ? load_report(:report => report) : {} end
Private Instance Methods
base_command()
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/rubocop_runner.rb, line 27 def base_command 'bundle exec rubocop' end
build_options(files:, options:, report:, **_kwargs)
click to toggle source
Calls superclass method
SleepingKingStudios::Tasks::ProcessRunner#build_options
# File lib/sleeping_king_studios/tasks/ci/rubocop_runner.rb, line 31 def build_options files:, options:, report:, **_kwargs options += ['--format=json', "--out=#{report}"] if report super :files => files, :options => options end
load_report(report: raw = File.read report)
click to toggle source
# File lib/sleeping_king_studios/tasks/ci/rubocop_runner.rb, line 37 def load_report report: raw = File.read report json = JSON.parse raw json['summary'] rescue {} end