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

Draft: clang-format init #1257

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

tigercosmos
Copy link
Collaborator

@tigercosmos tigercosmos commented Dec 7, 2023

For #1248 This is currently a draft for testing clang-format.

The .clang-format is now the default setting from clang-format 11

Welcome options for the coding styles.

Things to discuss:

  • The official clang-format version (based on difference OS, the default clang-format are also different. Once we choose the official version, users may need to go to LLVM website to download the corresponding version. For example, Debian 11 default is clang-format-11, Ubuntu 22 default is clang-format 14.
  • The rules in .clang-format. Basically we follow LLVM style, but may have some customized styles settings.

People can try to clone this patch, modify the .clang-format file, and run ./run_format.bash to see the result.

main file to check:

  • .clang-format
  • .github/workflows/format.yml

cc. @seladb @clementperon @egecetin @echo-Mike @sashashura

@@ -0,0 +1,37 @@
name: lint
Copy link
Collaborator

@egecetin egecetin Dec 7, 2023

Choose a reason for hiding this comment

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

pre-commit hooks already supports to clang-format check. Maybe instead of adding a new runner enabling it from config file might be better.

rev: v1.3.5
hooks:
- id: cppcheck
args: ["--std=c++11", "--language=c++", "--suppressions-list=cppcheckSuppressions.txt", "--inline-suppr", "--force"]
# - id: clang-format
- repo: https://github.com/codespell-project/codespell
People can run pre-commit run --all-files to check locally also they can see is there any other formatting issues. As a default it search .clang-format in workspace directory. This also eliminates the need of run_format.bash

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.

None yet

2 participants