Class: ConfirmableFixGenerator
- Inherits:
-
Sublayer::Generators::Base
- Object
- Sublayer::Generators::Base
- ConfirmableFixGenerator
- Defined in:
- lib/generators/confirmable_fix_generator.rb
Instance Method Summary collapse
-
#initialize(lint_failure:, source_code:, additional_instructions: nil) ⇒ ConfirmableFixGenerator
constructor
A new instance of ConfirmableFixGenerator.
- #prompt ⇒ Object
Constructor Details
#initialize(lint_failure:, source_code:, additional_instructions: nil) ⇒ ConfirmableFixGenerator
Returns a new instance of 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
#prompt ⇒ Object
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 <<-PROMPT You are an expert at remediating lint errors in source code. Generate a fix for the following lint failure in the provided source code. Only fix one specified lint failure at a time, at the given position. Source code: #{@source_code} Lint failure: #{@failure_line} Additional instructions (if any): #{@additional_instructions} For the fix provide: - description: A brief description of the change and why it is important. - fixed: the fixed source code with the issue resolved. - impact: A description of how the fix impacts assistive technologies. Provide your response is an object containing the above attributes. PROMPT end |