Skip to content

chore: move clang-tidy config file to project directory #1702

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

bavulapati
Copy link
Contributor

clang-tidy when the config is not explicitly mentioned in the command looks for it in the project directory with the name .clang-tidy. And editors like VS Code recognizes the .clang-tidy file when code analysis is enabled. This is not a fix for a bug. This is just trying to make clang-tidy config and usage more visible.

clang-tidy when the config is not explicitly mentioned in the command looks for it in the project directory with the name `.clang-tidy`.
And editors like VS Code recognizes the `.clang-tidy` file when code analysis is enabled.
This is not a fix for a bug. This is just trying to make clang-tidy config and usage more visible.

Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
@bavulapati bavulapati force-pushed the move-clang-tidy-config-to-project-directory branch from d2a48d7 to 587aea5 Compare May 27, 2025 15:12
Signed-off-by: Balakrishna Avulapati <bavulapati@gmail.com>
@@ -35,13 +35,11 @@ function(sourcemeta_target_clang_tidy)
file(GLOB_RECURSE SOURCEMETA_TARGET_CLANG_TIDY_FILES
${SOURCEMETA_TARGET_CLANG_TIDY_SOURCES})

set(CLANG_TIDY_CONFIG "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/clang-tidy.config")
Copy link
Member

Choose a reason for hiding this comment

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

Instead of removing this, can you tweak the variable to point at ${PROJECT_DIR}/.clang-tidy (or whatever the right variable name is?)

Copy link
Member

Choose a reason for hiding this comment

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

If we are moving this file, can we also do the same with the clang-format.config config file in the same directory?

@jviotti
Copy link
Member

jviotti commented May 28, 2025

Makes sense for this project, but keep in mind that other of my projects pull this repo as a dependency and re-use the same ClangTidy (and ClangFormat) config files. In those child projects, we would have the same problem, as the config files wouldn't be on the root.

As an alternative, is there a way we can commit Visual Studio Code config files or something to all repos to always point at the right config file locations, no matter where they are? There might be a way

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.

2 participants