Skip to content

[VL] Run clang-tidy in the native build job and narrow its check list - #12729

Open
philo-he wants to merge 5 commits into
apache:mainfrom
philo-he:fix-security-issue
Open

[VL] Run clang-tidy in the native build job and narrow its check list#12729
philo-he wants to merge 5 commits into
apache:mainfrom
philo-he:fix-security-issue

Conversation

@philo-he

@philo-he philo-he commented Aug 7, 2026

Copy link
Copy Markdown
Member

What changes are proposed in this pull request?

The clang-tidy check ran in cpp_clang_tidy.yml, a workflow_run job that consumed the native build artifact from another workflow. That could not work: only cpp/build/ is uploaded, so the compilation database's -I paths into ep/build-velox/ and dev/vcpkg/vcpkg_installed/ did not exist in the downstream job.

The check now runs in the existing cpp-test-udf-test job, which builds the native libraries in the same container and workspace, so the database and full header tree are already present.

Please note:
clang-tidy is newly enabled and runs with continue-on-error: true, so its findings are advisory. The check is diff-scoped, so it surfaces pre-existing findings in touched files; continue-on-error can be dropped once those are cleared.

How was this patch tested?

Depends on CI.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 5

@philo-he
philo-he force-pushed the fix-security-issue branch from acced7c to 998965c Compare August 8, 2026 18:41
This reverts commit a2d7505.
@philo-he
philo-he marked this pull request as ready for review August 8, 2026 22:43
Copilot AI lite review requested due to automatic review settings August 8, 2026 22:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR relocates clang-tidy execution into the existing Velox native build CI job (so it runs in the same workspace that produced compile_commands.json and headers) and centralizes/tightens the enabled check set via cpp/.clang-tidy, removing the separate downstream workflow_run clang-tidy workflow.

Changes:

  • Run clang-tidy inside Velox Backend (x86) native build job (and remove the prior workflow_run-based clang-tidy workflow).
  • Move the clang-tidy checks allow-list into cpp/.clang-tidy (and stop passing --checks from dev/run-clang-tidy.py).
  • Pin clang-tidy availability in the CentOS 9 build image by installing clang-tools-extra.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dev/run-clang-tidy.py Stop overriding checks via CLI; add support for forwarding extra toolchain args via env var.
dev/docker/Dockerfile.centos9-dynamic-build Install clang-tools-extra in the image to make clang-tidy available/pinned.
cpp/.clang-tidy Define the allow-listed clang-tidy checks and header filtering behavior as the single source of truth.
.github/workflows/velox_backend_x86.yml Execute clang-tidy in the native build job workspace and ensure checkout depth supports HEAD^..HEAD diffing.
.github/workflows/cpp_clang_tidy.yml Remove the prior downstream clang-tidy workflow that relied on incomplete artifacts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dev/run-clang-tidy.py
Comment on lines +86 to +89
# Checks come from 'cpp/.clang-tidy'; passing '--checks' here would override it.
# CLANG_TIDY_EXTRA_ARGS forwards toolchain details the compilation database omits.
extra_args = os.environ.get("CLANG_TIDY_EXTRA_ARGS", "").strip()

Copilot AI review requested due to automatic review settings August 10, 2026 01:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (2)

dev/run-clang-tidy.py:93

  • CLANG_TIDY_EXTRA_ARGS is parsed with shlex.split(...) without error handling. If the environment value contains unmatched quotes (or other shlex parse errors), this will raise ValueError and crash the script with a traceback instead of a clear message / non-zero exit code.
    extra_args = " ".join(
        shlex.quote(arg) for arg in shlex.split(os.environ.get("CLANG_TIDY_EXTRA_ARGS", ""))
    )

dev/run-clang-tidy.py:86

  • If run-clang-tidy.py is invoked with no file arguments and empty stdin, files can be empty and xargs may still execute clang-tidy once with no inputs (leading to a spurious failure). Adding an early return makes the script robust when called directly (and avoids confusing CI logs).
    fix = "--fix" if args.fix == "fix" else ""
    files = args.files

@philo-he

Copy link
Copy Markdown
Member Author

cc @zhouyuan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants