-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Format with clang-format 10 #3385
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
Conversation
There is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me. just wonder if it's possible to fix the indentation for private/protected/public.
cli/threadexecutor.h
Outdated
const std::map<std::string, std::size_t> &mFiles; | ||
Settings &mSettings; | ||
ErrorLogger &mErrorLogger; | ||
private: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer no indentation for private/protected/public
astyle is a small simple tool. imho it is simple to compile it myself on linux/windows. do you know how people will be able to install clang format version 10 on windows/linux? I would prefer to not install the whole llvm/clang/etc stuff but I guess they just bundle everything together.. |
Well version 3.1 is easier to build and install. We could try a newer version, but astyle has had no updates for 2 years whereas clang-format is being actively developed. So it seems like we might need to move to clang-format in the future anyways.
For ubuntu you can install it with For windows, you can download the binaries here. |
I updated it to outdent the labels. |
my recent debian distro only has clang-format-7 :-( I think a docker image with clang-format would be relatively ok for me but it's a quite complex dependency. I think it's important that I can reformat all code. occasional contributors can use |
I would not say we need to abandon it as long as we have no obvious problems. You have had problems to compile astyle right? I don't really understand what the problem is for you. |
It's not very good. That installation binary is 160MB .. and if all that is needed is clang-format this will not be appreciated. I am not strongly against clang-format but we need to consider that it can't be built easily and the installation is either missing or massive on many platforms. |
I could switch it to use clang-format-7, instead. I picked clang-format-10 since it was the latest version available on ubuntu 18.04 LTS.
Well its broken. I just checked with 3.1(the latest version), and it still breaks with compile errors(perhaps moving the comment around might fix it). Also, it makes a lot of code unreadable(like here), and we can workaround it with using
I had issues with older versions of astyle. Astyle 3.0 or later seems to work fine(I didnt realized you switched to a newer version). |
There is uncrustify which is more actively develop(and developed on github so it would be easier to add bug fixes), but I dont have any experience on how well it works. It doesn't use dijkstra's algorithm to find the best code format, so it might still format code in unreadable manner. The only other alternative that is still lightweight would be to consider building a our own formatter on top of simplecpp using dijkstra's algorithm to find the best code format. Clang format doesn't use clang's parser only its lexer. So we could use simplecpp to do the lexing and then apply a similar approach as what is done in clang-format. |
So uncrustify looks like it does a better job than astyle. I opened #3388 to format with uncrustify. There are a lot of settings so you can tweak it further if you would like to use that instead of clang-format. It can be easily built with |
Thanks! I feel that uncrustify is a much better alternative than clang-format. I close this PR. |
No description provided.