Skip to content

Add clang-tidy reviews to CI#1407

Merged
slaren merged 1 commit intoggml-org:masterfrom
slaren:tidy-ci
May 12, 2023
Merged

Add clang-tidy reviews to CI#1407
slaren merged 1 commit intoggml-org:masterfrom
slaren:tidy-ci

Conversation

@slaren
Copy link
Copy Markdown
Member

@slaren slaren commented May 11, 2023

Adds clang-tidy static analyzer and linter checks to pull requests.

The failed checks are reported in the PR in a comment, see these for some examples:
slaren#11
slaren#12 (here it finds a bug in the command line parsing of benchmark-matmult.cpp)

I tried to remove some of the most pedantic checks, but there are still a lot of failed checks in the current code that should be addressed over time. However, the workflow action will only report the checks failed in the lines modified by the PR, so the current issues will not be blamed on new PRs (unless they happen to be in the lines modified by the PR).

To test the settings in .clang-tidy locally:

  • Configure cmake with -DCMAKE_EXPORT_COMPILE_COMMANDS=on
  • Run clang-tidy with the cmake build path in -p and the source file, for example:
    clang-tidy -p build llama.cpp

Note that since this adds comments to the PRs, it requires adding write permissions to the workflows in the project settings.

Copy link
Copy Markdown
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

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

Should already have the write permission:

image

@Green-Sky
Copy link
Copy Markdown
Collaborator

I wanted to ask if it uses clang-tidy-diff, but the change suggestions look fine too.

@slaren
Copy link
Copy Markdown
Member Author

slaren commented May 11, 2023

It doesn't use clang-tidy-diff, but essentially it does the same, it checks what lines were modified and passes a -line-filter argument to clang-tidy. This is the action that I am using: https://github.com/marketplace/actions/clang-tidy-review

@slaren slaren merged commit 553fd4d into ggml-org:master May 12, 2023
@slaren slaren deleted the tidy-ci branch May 12, 2023 13:40
Seunghhon pushed a commit to Seunghhon/llama.cpp that referenced this pull request Apr 26, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
phuongncn pushed a commit to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4 that referenced this pull request Apr 28, 2026
* Update server string/regex ban documentation

* Update README.md

* Update README.md
ljubomirj pushed a commit to ljubomirj/llama.cpp that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants