Method: Solargraph::Diagnostics::RubocopHelpers.generate_options

Defined in:
lib/solargraph/diagnostics/rubocop_helpers.rb

.generate_options(filename, code) ⇒ Array(Array<String>, Array<String>)

Generate command-line options for the specified filename and code.

Parameters:

  • filename (String)
  • code (String)

Returns:

  • (Array(Array<String>, Array<String>))


35
36
37
38
39
40
41
# File 'lib/solargraph/diagnostics/rubocop_helpers.rb', line 35

def generate_options filename, code
  args = ['-f', 'j', '--force-exclusion', filename]
  base_options = RuboCop::Options.new
  options, paths = base_options.parse(args)
  options[:stdin] = code
  [options, paths]
end