|
| 1 | +version: "3" |
| 2 | + |
| 3 | +tasks: |
| 4 | + cpp-check: |
| 5 | + desc: "Runs the C++ linters." |
| 6 | + cmds: |
| 7 | + - task: "cpp-format-check" |
| 8 | + - task: "cpp-static-check" |
| 9 | + |
| 10 | + cpp-fix: |
| 11 | + desc: "Runs the C++ linters to fix all formatting issues and perform static code analysis. " |
| 12 | + cmds: |
| 13 | + - task: "cpp-format-fix" |
| 14 | + - task: "cpp-static-fix" |
| 15 | + |
| 16 | + cpp-format-check: |
| 17 | + desc: "Runs the C++ linters that identify formatting issues." |
| 18 | + sources: &cpp_format_src_files |
| 19 | + - "{{.G_LINT_VENV_CHECKSUM_FILE}}" |
| 20 | + - "{{.G_YSTDLIB_CPP_SRC_DIR}}/**/*.cpp" |
| 21 | + - "{{.G_YSTDLIB_CPP_SRC_DIR}}/**/*.h" |
| 22 | + - "{{.G_YSTDLIB_CPP_SRC_DIR}}/**/*.hpp" |
| 23 | + - "{{.ROOT_DIR}}/.clang-format" |
| 24 | + - "{{.TASKFILE}}" |
| 25 | + deps: |
| 26 | + - "cpp-configs" |
| 27 | + - "venv" |
| 28 | + cmds: |
| 29 | + - task: ":utils:clang-format" |
| 30 | + vars: |
| 31 | + FLAGS: "--dry-run" |
| 32 | + SRC_PATHS: |
| 33 | + ref: ".G_LINT_CPP_DIRS" |
| 34 | + VENV_DIR: "{{.G_LINT_VENV_DIR}}" |
| 35 | + |
| 36 | + cpp-format-fix: |
| 37 | + desc: "Runs the C++ linters and fixes all formatting issues." |
| 38 | + sources: *cpp_format_src_files |
| 39 | + deps: |
| 40 | + - "cpp-configs" |
| 41 | + - "venv" |
| 42 | + cmds: |
| 43 | + - task: ":utils:clang-format" |
| 44 | + vars: |
| 45 | + FLAGS: "-i" |
| 46 | + SRC_PATHS: |
| 47 | + ref: ".G_LINT_CPP_DIRS" |
| 48 | + VENV_DIR: "{{.G_LINT_VENV_DIR}}" |
| 49 | + |
| 50 | + cpp-static-check: |
| 51 | + # Alias task to `cpp-static-fix` since we don't currently support automatic fixes. |
| 52 | + # NOTE: clang-tidy does have the ability to fix some errors, but the fixes can be inaccurate. |
| 53 | + # When we eventually determine which errors can be safely fixed, we'll allow clang-tidy to |
| 54 | + # fix them. |
| 55 | + desc: "Runs the C++ static analyzers. Only checks for warnings and violations." |
| 56 | + aliases: |
| 57 | + - "cpp-static-fix" |
| 58 | + sources: |
| 59 | + - "{{.G_CMAKE_CACHE}}" |
| 60 | + - "{{.G_COMPILE_COMMANDS_DB}}" |
| 61 | + - "{{.G_LINT_VENV_CHECKSUM_FILE}}" |
| 62 | + - "{{.G_YSTDLIB_CPP_SRC_DIR}}/**/*.cpp" |
| 63 | + - "{{.G_YSTDLIB_CPP_SRC_DIR}}/**/*.h" |
| 64 | + - "{{.G_YSTDLIB_CPP_SRC_DIR}}/**/*.hpp" |
| 65 | + - "{{.ROOT_DIR}}/.clang-tidy" |
| 66 | + - "{{.TASKFILE}}" |
| 67 | + deps: |
| 68 | + - ":config-cmake-project" |
| 69 | + - "cpp-configs" |
| 70 | + - "venv" |
| 71 | + cmds: |
| 72 | + - task: ":utils:clang-tidy" |
| 73 | + vars: |
| 74 | + FLAGS: >- |
| 75 | + --config-file "{{.ROOT_DIR}}/.clang-tidy" |
| 76 | + -p "{{.G_COMPILE_COMMANDS_DB}}" |
| 77 | + SRC_PATHS: |
| 78 | + ref: ".G_LINT_CPP_DIRS" |
| 79 | + VENV_DIR: "{{.G_LINT_VENV_DIR}}" |
| 80 | + |
| 81 | + cpp-configs: |
| 82 | + internal: true |
| 83 | + sources: |
| 84 | + - "{{.ROOT_DIR}}/tools/yscope-dev-utils/lint-configs/.clang-format" |
| 85 | + - "{{.ROOT_DIR}}/tools/yscope-dev-utils/lint-configs/.clang-tidy" |
| 86 | + - "{{.TASKFILE}}" |
| 87 | + generates: |
| 88 | + - "{{.ROOT_DIR}}/.clang-format" |
| 89 | + - "{{.ROOT_DIR}}/.clang-tidy" |
| 90 | + dir: "{{.ROOT_DIR}}" |
| 91 | + cmds: |
| 92 | + - "tools/yscope-dev-utils/lint-configs/symlink-cpp-lint-configs.sh" |
0 commit comments