Nhảy tới nội dung
Phiên bản: 1.2.0

Autofix

Using The Autofix Feature

This feature allows you to execute commands that require CodeVista to integrate Sonarlint to detect violations and get solutions for that violated task in your current coding file. To implement this feature, the Sonarlint extension needs to be installed on the IDE. Follow these steps to use the Code Context feature:

1. Detected Autofix Violation.

  • Step 1: In the prompt input box, type the forward-slash character /, the command “/sonarlint-refactor” will be displayed as a predefined action.

    Command list.png

    Image: Command list

    After submitting the /sonarlint-refactor command prompt, the system will respond confirming the implementation of Identify Sonarlint Violations as bellow screenshot

    Execute Identify Violations

    Image: Execute Identify Sonalint Violations

  • Step 2: Click “Okay do it” to execute the Identify Sonarlint Violations.

  • Step 3: Click “Task Status” button to check the Identify Sonarlint Violation Task list.

2. No violation detected cases

The system displays “No violations found!” as below:

Untitled

3. Violation detected cases

The system displays “Identify Violation is done!” as below:

Untitled

  • Step 4: Select a “Identify Violations is done” to check details of violations line(s).

  • Step 5: Select violation line & click “Propose refactors” to propose refactors. Note: You can select/ deselect violations and propose again in this step 5.

    Untitled

    Image: Apply Refactor

4. Apply Refactor

  • Step 6: After proposing refactors, click "Next" and "Apply refactor" to confirm applying the solutions for the violation to your current file.

    Remember to review and verify the suggested refactor solution for violation before applying them to ensure they align with your intended functionality

    Apply Refactors

    Image: Apply Refactors