Updated on 2026-09-01 GMT+08:00

Using CodeArts Check MCP to Check Branch Code

Committing the develop-dev Branch Code

  1. Right-click the repo-demo code project and choose Open in Terminal from the shortcut menu. Run the following command in the terminal to verify that the develop-dev branch is the modified one:

    git branch
    If the following information is displayed, the current branch is correct:
    * develop-dev

  2. After the verification is successful, run the following command in the terminal to view the local code modifications:

    git status
    The following information is displayed, in which the content in red indicates the modified files that are not saved. Confirm the code to be committed.
    On branch develop-dev
    Your branch is up to date with 'origin/develop-dev'.
    
    Untracked files:
      (use "git add <file>..." to include in what will be committed)
            run-tests.ps1
            src/main/java/com/huawei/codearts/controller/TreeController.java
            src/main/java/com/huawei/codearts/tree/
            src/test/
            target/
    
    nothing added to commit but untracked files present (use "git add" to track)

  3. 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 committed to the staging area.

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

    git commit -m "feat: Add the code for the maximum path of the binary tree and the test execution script."
    If the following information is displayed, the code is successfully committed:
    [develop-dev e1256e8] feat: Add the code for the maximum path of the binary tree and the test execution script.
     Committer: testuser (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
    
     10 files changed, 295 insertions(+)
     create mode 100644 run-tests.ps1
     create mode 100644 src/main/java/com/huawei/codearts/controller/TreeController.java
     create mode 100644 src/main/java/com/huawei/codearts/tree/MaxPathSum.java
     create mode 100644 src/main/java/com/huawei/codearts/tree/MaxPathSumRunner.java
     create mode 100644 src/main/java/com/huawei/codearts/tree/TreeNode.java
     create mode 100644 src/test/java/com/huawei/codearts/tree/MaxPathSumTest.java
     create mode 100644 target/test-classes/com/huawei/codearts/tree/MaxPathSum.class
     create mode 100644 target/test-classes/com/huawei/codearts/tree/MaxPathSumManualTest.class
     create mode 100644 target/test-classes/com/huawei/codearts/tree/MaxPathSumRunner.class
     create mode 100644 target/test-classes/com/huawei/codearts/tree/TreeNode.class

  5. 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: 40, done.
    Counting objects: 100% (40/40), done.
    Delta compression using up to 16 threads
    Compressing objects: 100% (18/18), done.
    Writing objects: 100% (32/32), 7.24 KiB | 494.00 KiB/s, done.
    Total 32 (delta 1), 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
       2f31d8d..e1256e8  develop-dev -> develop-dev

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

Viewing Check Results

  1. Log in to the CodeArts console as a developer, and select AP-Singapore.
  2. Click Go to Workspace in the upper right corner to go to the CodeArts homepage.
  3. Click the req-demo card to go to the homepage of the project.
  4. In the navigation pane, choose Code > Check to go to the CodeArts Check homepage.
  5. On the Tasks tab, click repo-demo-check to go to the Overview page of repo-demo-check.
  6. Click the branch name, click Commit, and select the commit record to be checked.

    Figure 1 Selecting a commit record

  7. Click Issues on the top navigation bar to go to the code issue page of repo-demo-check.

    As shown in the following figure, 72 issues are detected in the latest commit.
    Figure 2 Code issues