Updated on 2026-08-03 GMT+08:00

Obtaining the Scan Report and Fixing the Code

Obtaining the Security Scan Report of the Latest Commit and Fixing the Code

  1. In the upper left corner of CodeArts Agent IDE, click Space to switch to CodeArts Agent Space.
  2. Click Coding.
  3. At the bottom of the input box, select AgentTeam to switch to the agent team mode. The selected model is displayed on the right. You can select a model as required from the drop-down list box.
  4. Enter the following prompt in the dialog box and click or press Enter:

    Obtain the security scan report of the latest commit and fix the code.

    CodeArts Agent IDE will call CodeArts Check MCP to return the path of the obtained report. You can view the code check report locally. The built-in sub-agent will continue to fix the code. Wait until the code fix is complete.

Committing the Fixed Code

  1. In the upper left corner of CodeArts Agent IDE, click IDE to switch to IDE.
  2. Run the following command in the terminal to view the local modifications and confirm the modified files:

    git status
    The following information is displayed, indicating the local modifications.
    On branch develop-dev
    Your branch is up to date with 'origin/develop-dev'.
    
    Changes not staged for commit:
      (use "git add <file>..." to update what will be committed)
      (use "git restore <file>..." to discard changes in working directory)
            modified:   src/main/java/com/huawei/codearts/controller/TreeController.java
            modified:   src/main/java/com/huawei/codearts/tree/MaxPathSum.java
            modified:   src/main/java/com/huawei/codearts/tree/MaxPathSumRunner.java
            modified:   src/main/java/com/huawei/codearts/tree/TreeNode.java
            modified:   src/test/java/com/huawei/codearts/tree/MaxPathSumTest.java
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
            .agent-team/
            .arts/

  3. Run the following command on the terminal to pull the latest code from the remote branch:

    # Pull updates from all remote branches.
    git fetch origin 
    # Merge the latest code of the remote develop-dev branch to the current local branch.
    git pull origin develop-dev
    • If the following information is displayed, no conflict occurs. Proceed with 4.
      nothing added to commit but untracked files present (use "git add" to track)
      From https://test.huawei.com/bb5f2eb7ded44e0bbc0ff4bd3d1d244c/repo-demo
       * branch            develop-dev -> FETCH_HEAD
      Already up to date.
    • If a conflict occurs, the terminal displays the conflicting file. You can manually open the file to modify the conflicting content. After the modification, run the following command and then go to 4.
      git add . 
      git commit -m "fix: Merge the remote code conflicts."

  4. Run the following command in the terminal to add the modifications to the staging area:

    git add .

    If no command output is displayed, the modified files are successfully submitted to the staging area.

  5. Run the following command in the terminal to commit the code locally:

    git commit -m "fix: Fix the scanned code issues."
    If the following information is displayed, the code is successfully committed:
    [develop-dev 55878b5] fix: Fix the scanned code issues.
     Committer: chenzhu (F) <test.com>
    Your name and email address were configured automatically based
    on your username and hostname. Please check that they are accurate.
    You can suppress this message by setting them explicitly:
    
        git config --global user.name "Your Name"
        git config --global user.email you@example.com
    
    After doing this, you may fix the identity used for this commit with:
    
        git commit --amend --reset-author
    
     9 files changed, 670 insertions(+), 24 deletions(-)
     create mode 100644 .agent-team/ses_07c6a4e4fffe71tWtQ6qZI4mD2/codefix/origin_report_4545383827873645935/index.json
     create mode 100644 .agent-team/ses_07c6a4e4fffe71tWtQ6qZI4mD2/codefix/origin_report_4545383827873645935/subReport_0.md
     create mode 100644 .agent-team/ses_07c6a4e4fffe71tWtQ6qZI4mD2/codefix/origin_report_4545383827873645935/subReport_1.md
     create mode 100644 .arts/settings.json

  6. Run the following command to push the code to the develop-dev branch on the remote cloud:

    git push origin develop-dev

    If the following information is displayed, the local code has been successfully committed to the cloud repository repo-demo.

    Enumerating objects: 47, done.
    Counting objects: 100% (47/47), done.
    Delta compression using up to 16 threads
    Compressing objects: 100% (18/18), done.
    Writing objects: 100% (30/30), 6.25 KiB | 112.00 KiB/s, done.
    Total 30 (delta 6), reused 0 (delta 0), pack-reused 0 (from 0)
    remote: Start Git Hooks Checking                                        [PASSED]
    remote:
    remote: To create a merge request for develop-dev, visit:
    remote:   https://test.com/codehub/2112135977/newmerge?branchName=develop-dev&projectNamespace=bb5f2eb7ded44e0bbc0ff4bd3d1d244c/repo-demo
    remote:
    To https://test.com/bb5f2eb7ded44e0bbc0ff4bd3d1d244c/repo-demo.git
       e1256e8..55878b5  develop-dev -> develop-dev

    After the code is successfully committed, CodeArts Check automatically triggers a check task on the cloud.

    After the scan is complete, view the latest check report. For details, see Viewing Check Results. As shown in the following figure, five issues remain to be fixed.

Fixing Code for the Second Time

  1. Use CodeArts Agent IDE to obtain the report and fix the code by referring to Obtaining the Security Scan Report of the Latest Commit and Fixing the Code.
  2. After the second code modification, commit the modified code by referring to Committing the Fixed Code.

    After the code is successfully committed, CodeArts Check automatically triggers a check task on the cloud.

    After the scan is complete, view the latest check report. For details, see Viewing Check Results. As shown in the following figure, all issues have been fixed.

    If there are still issues that have not been fixed in the report, refer to Obtaining the Security Scan Report of the Latest Commit and Fixing the Code.