-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Pass clang-format on various cpp/header files #5559
Conversation
Please tell me if some files are not good and why, and i will remove them from the changeset permitting others to merge |
887773f
to
21d135f
Compare
I passed it on various cpp trivial files to fix too. This permits to cover ~12% of our files with clang-format LINT check |
src/chat.h
Outdated
name(a_name), | ||
text(a_text) | ||
ChatLine(EnrichedString a_name, EnrichedString a_text) | ||
: age(0.0), name(a_name), text(a_text) |
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.
Spaces? Nope.
CavesRandomWalk(INodeDefManager *ndef, GenerateNotifier *gennotify = NULL, | ||
s32 seed = 0, int water_level = 1, | ||
content_t water_source = CONTENT_IGNORE, | ||
content_t lava_source = CONTENT_IGNORE); |
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.
1-tab is fine according to our code style guidelines.
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.
2-tab too?
The problem here is that we have to tell the formatter one of them...
The other code looks good. Feels like this is going to be a long way until everything's styled correctly. |
@SmallJoker yeah i ran clang-format on all files, 60k modifications if i remember. I remove chat.h from this changeset |
ac79c34
to
e35fdaa
Compare
i squashed the commits to have a full build with the current changeset |
@SmallJoker i rebased & squashed, please tell me if it's okay for you, i will merge when build was successful |
src/httpfetch.h
Outdated
void httpfetch_sync(const HTTPFetchRequest &fetch_request, | ||
HTTPFetchResult &fetch_result); | ||
|
||
void httpfetch_sync(const HTTPFetchRequest &fetch_request, HTTPFetchResult &fetch_result); |
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.
Length: 91, over the limits.
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.
strange to see how clang-format count, because it is limited to 90 chars
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.
using python interpreter it's good
>>> len("void httpfetch_sync(const HTTPFetchRequest &fetch_request, HTTPFetchResult &fetch_result);")
90
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.
90 is the absolute maximum. Whatever, looks good.
@sfan5 can you look at this please ? Note: with this commit 83 files are checked by clang-format over a total of 465 => ~17% |
src/drawscene.h
Outdated
void draw_scene(video::IVideoDriver *driver, scene::ISceneManager *smgr, Camera &camera, | ||
Client &client, LocalPlayer *player, Hud &hud, Minimap &mapper, | ||
gui::IGUIEnvironment *guienv, const v2u32 &screensize, | ||
const video::SColor &skycolor, bool show_hud, bool show_minimap); |
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.
while it may be useful to compact this, i would prefer if it didn't do this...
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.
both are compact, one respect 80 chars other 90 chars are you sure you want me to revert this change ?
src/event_manager.h
Outdated
{ | ||
static void receiverReceive(MtEvent *e, void *data) | ||
{ | ||
MtEventReceiver *r = (MtEventReceiver*)data; | ||
MtEventReceiver *r = (MtEventReceiver *)data; |
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.
why did it add a space here?
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.
because the rule for pointers is to have * at the right, then casts are affected
@@ -34,16 +34,16 @@ class KeyPress | |||
KeyPress(); | |||
KeyPress(const char *name); | |||
|
|||
KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character=false); | |||
KeyPress(const irr::SEvent::SKeyInput &in, bool prefer_character = 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.
is this part of our guidelines?
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.
no, it's a choice of LLVM to have readable code when using equal, and i'm not afraid, i prefer having it it permit to view more easily default values
@@ -55,7 +56,7 @@ void TestNodeDef::testContentFeaturesSerialization() | |||
|
|||
std::ostringstream os(std::ios::binary); | |||
f.serialize(os, LATEST_PROTOCOL_VERSION); | |||
//verbosestream<<"Test ContentFeatures size: "<<os.str().size()<<std::endl; | |||
// verbosestream<<"Test ContentFeatures size: "<<os.str().size()<<std::endl; |
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 understand why its doing this but this is quite stupid nonetheless
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.
it's a tool, it's not an IA, the change it just for respect the coding style
@sfan5 waiting for your update :) |
e35fdaa
to
8f555d3
Compare
rebased and i removed some files from PR as they are not very convenient, i think i will merge it tomorrow |
I ran clang-format on all my header files and choose an interesting compliant subset. Please review and we merge, those headers are not heavily modified in PR.