Checking Code
Committing code
- Right -click 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 modified:
git branch
If the following information is displayed, the current branch is correct:* develop-dev
- 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) - 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.
- 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: 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 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 - 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
- Log in to the CodeArts console, and select AP-Singapore.
- Click Go to Workspace in the upper right corner to go to the CodeArts homepage.
- Click the req-demo project to go to the homepage of the project.
- In the navigation pane, choose Code > Check. The CodeArts Check homepage is displayed.
- On the Tasks tab, click repo-demo-check. The Overview page of repo-demo-check is displayed.
- Click the branch name, click Commit, and select the commit record to be checked.
- Click Issues in the navigation bar.
As shown in the following figure, 72 issues are detected in the latest commit.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot