Closed hsluoyz closed 4 years ago
Any suggestions? @xcaptain @nodece @GopherJ @divy9881 @zipochan
I think clang-format is good, maybe we can give it a try
@xcaptain not bad!
https://github.com/marketplace/actions/ros-style-guide-c-format Its a github-action for automatic C++ code-formatter according to clang format
some other github-actions: https://github.com/marketplace/actions/c-code-linter-clang-tidy-and-cppcheck https://github.com/marketplace/actions/c-c-code-linter-clang-tidy-clang-format-and-cppcheck
Let me know, which one, I will set it up.
@xcaptain @divy9881
I have several criteria:
Which ones fulfill these?
I have several criteria:
Works for all OSes: Windows, Linux, (better have macOS) Works for IDEs: Jetbrains CLion, Visual Studio, (better have VSCode) Which ones fulfill these?
Sorry, I didn't understand your question, the above links are the links to the github-actions, it gets triggered after all other build-tasks are successful and after may be merging.
The linter I mean here is that when I type in code, the IDE will auto format my code. Usually IDE has its built-in linter or kind of similar things. But I want a standardized tool to work for all IDEs.
Your server-side linter hooks are also useful. We can have both. I don't give up client-side IDE linter because I still want to see how my code is formatted in my eyes. I don't want to give the control to the machine.
Then, I think we can set-up just git-hook for code linting using npm and clang-format as node-package, like node-casbin.
Will npm package work for CLion?
Will npm package work for CLion?
To setup a git-hook a contributor will have to install the npm packages from command line tool and after he adds the changed files to the staging area through git add
the code formatting triggers automatically.
Then I think maybe a tool like https://editorconfig.org/ is better. It's just a config file inside the repo (like Travis CI config). And the IDE can automatically recognize it and apply the code format checking.
IDE is not related to this repo I believe,developers need to use their own tool.
But it's true that we need some lint actions to?validate PR code style,is there already an action for clang-format? in vim I use clang,clang-format
code can be formstted onced saved
This repo can also have custom style lint config but it's normally not necessary
Add the clangformat for Visual Studio.
@hsluoyz Have added clang-format,which can be used in visual studio.
I can usually find a lot of code style issues in our code like this PR: https://github.com/casbin/casbin-cpp/pull/48. I don't want to review and fix them one by one. We need a systematic and automatic way to solve it.
How does C/C++ solve the code linting issue? I want a solution better working for multiple OSes, multiple IDEs. I only know something like EditorConfig: https://editorconfig.org/
What tool does C/C++ project often use for code linter?