Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Enable clang-tidy linting task and configure it to run on files without violations. #99

Merged
merged 5 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ jobs:

- uses: "actions/setup-python@v5"
with:
python-version: "3.11"
# NOTE: We resolve some of clang-tidy's IWYU violations using CPython 3.10's headers, so
# we need to use the same version of Python when running clang-tidy.
python-version: "3.10"

- run: |
pip install --upgrade pip
Expand Down
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,19 @@ The commands above run all linting checks, but for performance you may want to r
if you only changed C++ files, you don't need to run the YAML linting checks) using one of the tasks
in the table below.

| Task | Description |
|-------------------------|----------------------------------------------------------|
| `lint:cmake-check` | Runs the CMake linters. |
| `lint:cmake-fix` | Runs the CMake linters and fixes any violations. |
| `lint:cpp-check` | Runs the C++ linters (formatters and static analyzers). |
| `lint:cpp-fix` | Runs the C++ linters and fixes some violations. |
| `lint:cpp-format-check` | Runs the C++ formatters. |
| `lint:cpp-format-fix` | Runs the C++ formatters and fixes some violations. |
| `lint:py-check` | Runs the Python linters. |
| `lint:py-fix` | Runs the Python linters and fixes some violations. |
| `lint:yml-check` | Runs the YAML linters. |
| `lint:yml-fix` | Runs the YAML linters and fixes some violations. |
| Task | Description |
|-------------------------|---------------------------------------------------------|
| `lint:cmake-check` | Runs the CMake linters. |
| `lint:cmake-fix` | Runs the CMake linters and fixes any violations. |
| `lint:cpp-check` | Runs the C++ linters (formatters and static analyzers). |
| `lint:cpp-fix` | Runs the C++ linters and fixes some violations. |
| `lint:cpp-format-check` | Runs the C++ formatters. |
| `lint:cpp-format-fix` | Runs the C++ formatters and fixes some violations. |
| `lint:cpp-static-check` | Runs the C++ static analyzers. |
| `lint:py-check` | Runs the Python linters. |
| `lint:py-fix` | Runs the Python linters and fixes some violations. |
| `lint:yml-check` | Runs the YAML linters. |
| `lint:yml-fix` | Runs the YAML linters and fixes some violations. |

[1]: https://github.com/y-scope/clp/tree/main/components/core
[2]: https://github.com/y-scope/clp
Expand Down
14 changes: 7 additions & 7 deletions lint-tasks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,18 @@ tasks:
FLAGS: "--in-place"

cpp-configs:
# TODO: remove this once all clang-tidy has been fixed
deps: [":config-cmake-project"]
cmds:
- "tools/yscope-dev-utils/lint-configs/symlink-cpp-lint-configs.sh"

cpp-check:
cmds:
- task: "cpp-format-check"
# TODO: re-enable this once all clang-tidy has been fixed
# - task: "cpp-static-check"
- task: "cpp-static-check"

cpp-fix:
cmds:
- task: "cpp-format-fix"
# TODO: re-enable this once all clang-tidy has been fixed
# - task: "cpp-static-fix"
- task: "cpp-static-fix"

cpp-format-check:
sources: &cpp_format_src_files
Expand Down Expand Up @@ -107,7 +103,11 @@ tasks:
--config-file "{{.CLP_FFI_PY_CPP_SRC_DIR}}/.clang-tidy"
-p "{{.CLP_FFI_PY_COMPILE_COMMANDS_DB}}"
SRC_PATHS:
ref: ".G_CPP_LINT_DIRS"
# TODO: Before all clang-tidy violations are resolved, we should only run clang-tidy on
# the files whose violations we've fixed, both to ensure they remain free of violations
# and so that the workflow doesn't fail due to violations in other files.
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.cpp"
- "{{.CLP_FFI_PY_CPP_SRC_DIR}}/Py_utils.hpp"
VENV_DIR: "{{.G_LINT_VENV_DIR}}"

py-check:
Expand Down
Loading