Class: ConfirmableFixGenerator

Inherits:
Sublayer::Generators::Base
  • Object
show all
Defined in:
lib/generators/confirmable_fix_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(lint_failure:, source_code:, additional_instructions: nil) ⇒ ConfirmableFixGenerator



26
27
28
29
30
31
# File 'lib/generators/confirmable_fix_generator.rb', line 26

def initialize(lint_failure:, source_code:, additional_instructions: nil)
  super()
  @source_code = source_code
  @additional_instructions = additional_instructions
  @failure_line = %(#{lint_failure.description} at span #{lint_failure.location[0]}:#{lint_failure.location[1]})
end

Instance Method Details

#promptObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/generators/confirmable_fix_generator.rb', line 33

def prompt
  "  You are an expert at remediating lint errors in source code.\n  Generate a fix for the following lint failure in the provided source code.\n  Only fix one specified lint failure at a time, at the given position.\n\n  Source code:\n  \#{@source_code}\n\n  Lint failure:\n  \#{@failure_line}\n\n  Additional instructions (if any):\n  \#{@additional_instructions}\n\n  For the fix provide:\n  - description: A brief description of the change and why it is important.\n  - fixed: the fixed source code with the issue resolved.\n  - impact: A description of how the fix impacts assistive technologies.\n\n  Provide your response is an object containing the above attributes.\n  PROMPT\nend\n"