Module: Evilution::MCP::MutateTool::OptionParser Private

Defined in:
lib/evilution/mcp/mutate_tool/option_parser.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: ParsedPaths

Constant Summary collapse

VALID_VERBOSITIES =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[full summary minimal].freeze
PASSTHROUGH_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[target timeout jobs fail_fast suggest_tests incremental integration
isolation baseline save_session preload].freeze
ALLOWED_OPT_KEYS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

(PASSTHROUGH_KEYS + %i[spec skip_config]).freeze

Class Method Summary collapse

Class Method Details

.normalize_verbosity(value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
45
46
47
48
# File 'lib/evilution/mcp/mutate_tool/option_parser.rb', line 42

def self.normalize_verbosity(value)
  normalized = value.to_s.strip.downcase
  normalized = "summary" if normalized.empty?
  return normalized if VALID_VERBOSITIES.include?(normalized)

  raise Evilution::ParseError, "invalid verbosity: #{value.inspect} (must be full, summary, or minimal)"
end

.parse_files(raw_files) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/evilution/mcp/mutate_tool/option_parser.rb', line 13

def self.parse_files(raw_files)
  files = []
  ranges = {}

  raw_files.each do |arg|
    file, range_str = arg.split(":", 2)
    files << file
    next unless range_str

    ranges[file] = parse_line_range(range_str)
  end

  ParsedPaths.new(files: files, ranges: ranges)
end

.parse_line_range(str) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/evilution/mcp/mutate_tool/option_parser.rb', line 28

def self.parse_line_range(str)
  if str.include?("-")
    start_str, end_str = str.split("-", 2)
    start_line = Integer(start_str)
    end_line = end_str.empty? ? Float::INFINITY : Integer(end_str)
    start_line..end_line
  else
    line = Integer(str)
    line..line
  end
rescue ArgumentError, TypeError
  raise Evilution::ParseError, "invalid line range: #{str.inspect}"
end

.validate!(opts) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



50
51
52
53
54
55
# File 'lib/evilution/mcp/mutate_tool/option_parser.rb', line 50

def self.validate!(opts)
  unknown = opts.keys - ALLOWED_OPT_KEYS
  return if unknown.empty?

  raise Evilution::ParseError, "unknown parameters: #{unknown.join(", ")}"
end