Skip to content

Conversation

@zeyi2
Copy link
Contributor

@zeyi2 zeyi2 commented Nov 10, 2025

Add an .editorconfig file, this helps contributors’ editors auto‑apply these conventions and reduces regressions.

This is part of the documentation improvement discussed in #167098

insert_final_newline = true
end_of_line = lf
indent_style = space
indent_size = 2
Copy link
Contributor Author

@zeyi2 zeyi2 Nov 10, 2025

Choose a reason for hiding this comment

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

I'm not sure whether this is necessary. The clang-tidy docs currently mix single- ,double-, triple-space indentation. (mainly in .. code-block:: and .. option::)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd personally want to have double-indentation everywhere but a lot of existing options are using triple- so we shouldn't enforce double- right now.
We could in the future after some extensive refactoring but I don't think it's a big priority.

@@ -0,0 +1,8 @@
[clang-tidy/checks/**/*.rst]
Copy link
Contributor

@vbvictor vbvictor Nov 10, 2025

Choose a reason for hiding this comment

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

Instead of this path, could we just place it in clang-tool-extra/docs/clang-tidy/checks/?
Will it work like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It will work, I'll move it to that folder :)

Copy link
Contributor Author

@zeyi2 zeyi2 Nov 10, 2025

Choose a reason for hiding this comment

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

Instead of this path, could we just place it in clang-tool-extra/docs/clang-tidy/checks/? Will it work like that?

Also, should we apply these checks to list.rst? The 80 chars limitation may require a lot of refactoring for this file.

Update: I currently disable long line check for this file and keep other checks active.

@EugeneZelenko
Copy link
Contributor

But what about C/C++/Python/CMake files?

@vbvictor
Copy link
Contributor

But what about C/C++/Python/CMake files?

For C/C++ we have clang-format.
For CMake we have strategy "just make look like everywhere else" so I don't see how we can use different style of Cmake files in clang-tidy

@EugeneZelenko
Copy link
Contributor

But what about C/C++/Python/CMake files?

For C/C++ we have clang-format. For CMake we have strategy "just make look like everywhere else" so I don't see how we can use different style of Cmake files in clang-tidy

insert_final_newline seems reasonable setting for all kinds of files - it's often missing in C/C++ files. max_line_length (if shown in editor as vertical line, like Visual Studio Code does) is also helpful.

@zeyi2
Copy link
Contributor Author

zeyi2 commented Nov 11, 2025

Hi, I've added a new .editorconfig file for clang-tidy, it will apply checks to all the files under the folder.

@vbvictor
Copy link
Contributor

We should gather opinions from other maintainers before pushing this.

One could argue that 3rd party configs should not be pushed to repo. Because if we push editorconfig, why not .vscode config, .nvim, .idea and so on.

@zeyi2
Copy link
Contributor Author

zeyi2 commented Nov 12, 2025

We should gather opinions from other maintainers before pushing this.

One could argue that 3rd party configs should not be pushed to repo. Because if we push editorconfig, why not .vscode config, .nvim, .idea and so on.

Maybe open a RFC thread on the discourse forum? I'm not completely sure if continuing the discussion within the PR is ideal, since only clang-tidy reviewer are likely to see it.


Also, LegalizeAdulthood gave an example of an existing editorconfig inside llvm codebase: https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/.editorconfig. Maybe it is acceptable, as other modules have already adopted a similar approach?

WDYT?

@EugeneZelenko
Copy link
Contributor

One could argue that 3rd party configs should not be pushed to repo. Because if we push editorconfig, why not .vscode config, .nvim, .idea and so on.

Maybe open a RFC thread on the discourse forum? I'm not completely sure if continuing the discussion within the PR is ideal, since only clang-tidy reviewer are likely to see it.

Sure, wider discussion will be helpful. We use project-wide Visual Studio Code config at work and I found it very useful. It goes beyond editor setting, but set up C++ extension (Clang-Format, Clang-Tidy), builds and debug.

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