-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Format with uncrustify #3388
Format with uncrustify #3388
Conversation
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.
uncrustify looks promising
lib/checkio.h
Outdated
@@ -75,7 +73,7 @@ class CPPCHECKLIB CheckIO : public Check { | |||
|
|||
private: | |||
class ArgumentInfo { | |||
public: | |||
public: |
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.
hmm this indentation looks very strange. fixable?
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.
Yes! It was fixable with:
indent_access_spec = -4
as far as I see uncrustify is lightweight and easy to build. and the formatting looks acceptable. It is totally acceptable for me. However I do not understand the problem with astyle. I do not get any compilation error when I build for instance astyle-3.0.1 with g++ 8.3.0. The formatting is not perfect with astyle-3.0.1 but it's something at least I can accept. I do not believe formatting will be perfect with any tool. As you said somewhere it's not a good idea to clutter the code with INDENT-* comments. |
cli/main.cpp
Outdated
std::cout << "Unknown exception" << std::endl; | ||
} | ||
return EXIT_FAILURE; | ||
} |
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.
this is unfortunate. astyle handled this piece of code better. but I guess it's a rare case and can accept it.
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.
Yea uncrustify can't match up the braces, it throws this error on this file:
flag_parens(22): no match for '{' at [93:9] [CallStack:-DEBUG NOT SET-]
Doing
The syntax errors are unacceptable. Also, I find the readability to be unacceptable(like here), which is why I use
Well tools like uncrustify and astyle are definitely not perfect as they only consider one way to format whereas as clang-format will try to choose the best formatting among different possibilities. Since you dont want to use clang-format due to slow internet connection, I think uncrustify is a much better option. It has more settings that can be tweaked and is being actively developed so the issues that we find may be fixed in a future version. |
cli/cmdlineparser.cpp
Outdated
, mExitAfterPrint(false) | ||
{ | ||
} | ||
, mShowHelp(false) |
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.
hmm.. can this comma have the same indentation as the colon?
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.
Yes, but if we use trailing commas then the variables will be aligned to the :
instead of variable name.
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.
ok that is unfortunate.. but maybe we can adjust the source files..
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.
So I changed the indent_constr_colon
setting to false
to get it to align with leading commas. You can tweak this and the source files to get the style you want. There might be a way to enforce trailing commas, but I am not sure.
ok let's switch to uncrustify.. |
I hope you are happy.. I merge this. |
Thanks! |
No description provided.