mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
better docs (#3392)
This commit is contained in:
Vendored
+1
-1
@@ -16,7 +16,7 @@
|
||||
"external/win32/include/glslang",
|
||||
"external/win32/include/v8"
|
||||
],
|
||||
"compileCommands": "compile_commands.json"
|
||||
"compileCommands": "${workspaceFolder}/compile_commands.json"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
|
||||
@@ -14,12 +14,13 @@ For now, **Visual Studio Code** is our first recommended IDE for the job, while
|
||||
|
||||

|
||||
|
||||
* Open terminal (or git-bash if you are on windows), navigate to `engine-native` folder and run:
|
||||
* Open terminal (or git-bash/MSYS2 if you are on windows), navigate to `engine-native` folder and run:
|
||||
|
||||
```bash
|
||||
utils/generate_compile_commands_android.sh
|
||||
```
|
||||
|
||||
You may need to have `make` in your environment path for it to work.
|
||||
If it succeeds, you should see a `compile_commands.json` generated in the same folder, and ignored by git.
|
||||
|
||||

|
||||
@@ -62,7 +63,7 @@ For now, **Visual Studio Code** is our first recommended IDE for the job, while
|
||||
|
||||
This is a screenshot of linting issue-free files.
|
||||
|
||||
* For `Clang-Format` issues, there will be no in-place editor suggestions, but all issues are strictly auto-fixable, and if the environment set up above goes smoothly, it is as simple as execute the `Format Document` command. (By default `Shift + Alt + F` on Windows)
|
||||
* For `Clang-Format` issues, there will be no in-place editor suggestions, but all issues are strictly auto-fixable, and if the environment set up above goes smoothly, it is as simple as executing the `Format Document` command. (By default `Shift + Alt + F` on Windows)
|
||||
|
||||

|
||||
|
||||
@@ -70,9 +71,9 @@ For now, **Visual Studio Code** is our first recommended IDE for the job, while
|
||||
|
||||

|
||||
|
||||
On the contrary to `Clang-Tidy`, `Clang-Format` auto-formating is a immediate operation and should be used frequently.
|
||||
On the contrary to `Clang-Tidy`, `Clang-Format` auto-formatting is an immediate operation and should be used frequently.
|
||||
|
||||
> Note: The `compile_commands.json` generated by current approach is essentially the Android development environment. So other platform-specific code may likely not be included in the check. This behavior is consistent with CI test environment.
|
||||
> Note: The `compile_commands.json` generated by the current approach is essentially the Android development environment. So other platform-specific code may likely not be included in the check. This behavior is consistent with the CI test environment.
|
||||
|
||||
> Also note: Once new source files have been added to the project in the CMakeLists, the `compile_commands.json` has to be regenerated by running the same script in the third step.
|
||||
|
||||
@@ -80,14 +81,14 @@ For now, **Visual Studio Code** is our first recommended IDE for the job, while
|
||||
|
||||
The second recommended way is to directly use the CLI.
|
||||
|
||||
We provide a bash script to apply auto fix on all the changed files in arbitrary commit/range:
|
||||
We provide a bash script to apply auto-fix on all the changed files in arbitrary commit/range:
|
||||
|
||||
First make sure the first three step in VS Code environment setup are done, i.e. `compile_commands.json` has been generated, then:
|
||||
First make sure the first three steps in VS Code environment setup are done, i.e. `compile_commands.json` has been generated, then:
|
||||
|
||||
```bash
|
||||
utils/tidy-fix-commit.sh # run auto fix on files in the latest commit
|
||||
utils/tidy-fix-commit.sh 70181ed # run auto fix on files in the specified commit
|
||||
utils/tidy-fix-commit.sh HEAD~3..HEAD # run auto fix on files in the last 3 commit
|
||||
utils/tidy-fix-commit.sh # run auto-fix on files in the latest commit
|
||||
utils/tidy-fix-commit.sh 70181ed # run auto-fix on files in the specified commit
|
||||
utils/tidy-fix-commit.sh HEAD~3..HEAD # run auto-fix on files in the last 3 commit
|
||||
```
|
||||
|
||||
All the issues will be reported in the standard output. This can be used as local self-test runs for CI checks.
|
||||
@@ -98,6 +99,6 @@ The CLI scripts can(and are recommended to) be used as complements to the VS Cod
|
||||
|
||||
It is possible to use other IDEs as long as they [support Clang-Tidy](https://clang.llvm.org/extra/clang-tidy/Integrations.html).
|
||||
|
||||
Notably there is `CLion`, or the `Resharper C++` MSVC extension that can do a fairly decent job on analysing and fixing linter issues. But both are commercially licensed and [intentionally](https://resharper-support.jetbrains.com/hc/en-us/articles/207242695-Can-I-fix-all-issues-Quick-Fixes-naming-suggestions-etc-at-once-) lacks the functionality to apply fixes to all the issues. They can either apply auto fix per instance, or apply to the whole project by issue types.
|
||||
Notably there is `CLion`, or the `Resharper C++` MSVC extension that can do a fairly decent job on analyzing and fixing linter issues. But both are commercially licensed and [intentionally](https://resharper-support.jetbrains.com/hc/en-us/articles/207242695-Can-I-fix-all-issues-Quick-Fixes-naming-suggestions-etc-at-once-) lacks the functionality to apply fixes to all the issues. They can either apply auto-fix per instance or apply to the whole project by issue types.
|
||||
|
||||
Considering the current circumstances this is usually not what we want in daily development, since the more files we touch, the heavier the burden is to pass the CI check, which detects problems on all the changed files in a single pull request.
|
||||
|
||||
Reference in New Issue
Block a user