Class BasicReviewer

java.lang.Object
org.machanism.machai.gw.reviewer.BasicReviewer
All Implemented Interfaces:
Reviewer

public class BasicReviewer extends Object implements Reviewer
Reviewer implementation for Python source files (.py).

Guidance may appear in either single-line comments (#) or in triple-quoted strings that contain the @guidance tag.

  • Field Details

    • promptBundle

      private final ResourceBundle promptBundle
      Resource bundle containing prompt templates for reviewed files.
    • VBA_GUIDANCE_PATTERN

      private static final Pattern VBA_GUIDANCE_PATTERN
      Matches a VBA line comment carrying the guidance tag: ' GUIDANCE: text Rem GUIDANCE: text Also matches trailing comments after code (e.g. x = 1 ' GUIDANCE: text), but only when the apostrophe is not inside a string literal.
  • Constructor Details

    • BasicReviewer

      public BasicReviewer()
  • Method Details

    • getSupportedFileExtensions

      public String[] getSupportedFileExtensions()
      Description copied from interface: Reviewer
      Returns the file extensions (without the dot) that this reviewer can process.
      Specified by:
      getSupportedFileExtensions in interface Reviewer
      Returns:
      an array containing "bas", "cls" and "frm"
    • perform

      public String perform(File projectDir, File guidancesFile) throws IOException
      Reviews a VBA file for line-comment guidance.
      Specified by:
      perform in interface Reviewer
      Parameters:
      projectDir - the project root used to compute a relative path
      guidancesFile - the VBA file to inspect
      Returns:
      a formatted prompt, or null when no non-blank guidance is found
      Throws:
      IOException - if the file cannot be read