Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Aider Autofix plugin leverages LLM tools to fix code violations in your Java projects projects running within automated CI/CD pipelines, based on a generated analysis report. Jtest identifies violations, uses LLM integration to propose fixes for those violations, and verifies each proposed fix to ensure that all issues are fully resolved and no new problems are introduced. Successful fixes result in automatically created commits in the working branch of your project source control repository, enabling manual review and approval before merging.

The Jtest Autofix Python script is located in <INSTALL_DIR>/integration/aider.

Note: Support for the Aider Autofix plugin is deprecated and will be removed in future releases.

Prerequisites

The following are required to use this functionality:

...

  1. Create a virtual environment:
    Code Block
    python -m venv venv
  2. Enter the virtual environment:
    Code Block
    source venv/bin/activate
  3. Install required dependencies:
    Code Block
    python -m pip install --upgrade pip
    pip install -r requirements.txt

Autofix Autofix Configuration Options

The JtestAutoFix.py script can be configured using environment variables or command-line arguments. Command-line arguments take precedence over environment variables when both are specified.

...

  1. Set your API key:
    Code Block
    SET OPENAI_API_KEY=your_secret_open_ai_key
  2. Execute Autofix with the recommended settings:
    Code Block
    python JtestAutoFix.py
     --report "<PROJECT_PATH>/build/jtest/report.xml"
     --max-attempts 3
     --data "<PROJECT_PATH>/build/jtest/jtest.data.json"
     --tool-home "C:\Program Files\Parasoft\Jtest\

...

  1. 2026.

...

  1. 1"

Linux/Unix

  1. Set your API key:
    Code Block
    export OPENAI_API_KEY=your_secret_open_ai_key
  2. Execute Autofix with the recommended settings:
    Code Block
    python3 JtestAutoFix.py
     --report "<PROJECT_PATH>/build/jtest/report.xml"
     --max-attempts 3
     --data "<PROJECT_PATH>/build/jtest/jtest.data.json"
     --tool-home "/opt/parasoft/jtest/20252026.21"

Advanced Usage Examples

Windows with the Verification Command

  1. Set the environment variables:
    Code Block
    SET OPENAI_API_KEY=your_secret_open_ai_key
    SET MODEL_NAME=gpt-4.1
    SET WEAK_MODEL_NAME=gpt-4o-mini
  2. Execute Autofix with build verification:
    Code Block
    python JtestAutoFix.py
     --report "C:\projects\myapp\build\jtest\report.xml"
     --data "C:\projects\myapp\build\jtest\jtest.data.json"
     --tool-home "C:\Program Files\Parasoft\Jtest\20252026.21"
     --verification-command "gradle build"
     --fix-limit 10
     --max-attempts 2

...

  1. Set the environment variables:
    Code Block
    export OPENAI_API_KEY=your_secret_open_ai_key
    export MODEL_NAME=gpt-4.1
    export WEAK_MODEL_NAME=gpt-4o-mini
  2. Execute Autofix with build verification:
    Code Block
    python JtestAutoFix.py
     --report "/home/user/projects/myapp/build/jtest/report.xml"
     --data "/home/user/projects/myapp/build/jtest/jtest.data.json"
     --tool-home "/opt/parasoft/jtest/20252026.21"
     --verification-command "./gradlew build"
     --fix-limit 10
     --max-attempts 2
Note

To ensure accurate results and efficient use of the Autofix plugin, follow these best practices:

Generate a new baseline after each Autofix session: Code changes made during the autofix process can alter file line numbers and structure, making the violation locations in your original report.xml obsolete. Regenerate your baseline report to ensure it accurately reflects your updated codebase.

Fix history tracking: The script creates data files in the .cliAutoFix folder to track fix attempts and outcomes in *.history.yaml files.

Preserve history: To avoid re-attempting the same violations:

  • Preserve the .cliAutoFix folder and its *.history.yaml files between runs.
  • Alternatively, ensure all attempted violations are either fixed or suppressed before the next run.

Reviewing Results

After each successful fix, the Autofix script creates a commit in your repository. Since AI-generated code may contain errors or suboptimal solutions, it is crucial to review all changes carefully.

...