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

Style all (non-clang) code with clang-format #63

Open
bvdberg opened this issue Nov 8, 2018 · 12 comments
Open

Style all (non-clang) code with clang-format #63

bvdberg opened this issue Nov 8, 2018 · 12 comments
Milestone

Comments

@bvdberg
Copy link
Member

bvdberg commented Nov 8, 2018

Does anyone see issues with the current .clang-format file?

@lerno
Copy link
Collaborator

lerno commented Nov 8, 2018

I'll have a look. Appears that there's a plugin for AppCode that swaps the auto format of AppCode with clang-format.

@lerno
Copy link
Collaborator

lerno commented Nov 8, 2018

If we use clang-format (and I don't see why not), add a passage in "working on C2" that we use it and if working on AppCode one can use the ClangFormatJ plugin.

@bvdberg
Copy link
Member Author

bvdberg commented Nov 8, 2018

What do you mean with adding a passage?

I meant using clang-format for the c2c code written in c++, not using it to style c2 code. For c2 I think
we need to create a c2format or c2style tool.

@lerno
Copy link
Collaborator

lerno commented Nov 8, 2018

A few bugs:

SmallVector <IdentifierInfo *, 32> Parameters => SmallVector < IdentifierInfo * , 32 > Parameters
IdentifierInfo* II and IdentifierInfo *II => IdentifierInfo * II

do {
    foo();
} while (true);

Became

do {
    foo();
}
while (true);

There might be more.

@lerno
Copy link
Collaborator

lerno commented Nov 9, 2018

I mean add some text on the github wiki or in the docs about it.

By the way, is there a way to get wiki access? I was thinking of documenting the parser as I go along.

@bvdberg
Copy link
Member Author

bvdberg commented Nov 9, 2018 via email

@luciusmagn
Copy link
Contributor

luciusmagn commented Nov 9, 2018

Yea, you either need to open the wiki for everyone to edit, or add those people as collaborators, neither of which particularly fits the case.

@lerno
Copy link
Collaborator

lerno commented Nov 9, 2018

Are collaborators the only ones that can be assigned to tasks as well? It's a bit weird not being able to get assigned to something you're working on.

@luciusmagn
Copy link
Contributor

@lerno Yeah, one can only assign the owner, collaborators or organization members afaik, on Github

@bvdberg bvdberg added this to the 1 milestone Dec 2, 2018
@lerno
Copy link
Collaborator

lerno commented Dec 3, 2018

@bvdberg I humbly pray for a different switch format. I find

switch (foo) {
case 1:
}

Inconsistent (the only construct that doesn't respect indent!) and near impossible to read (can't rely on indent to see where we are)

I know the idea is that case is a label (so it does not create a new scope – unlike C2!), but I really think there is a huge readability loss. The 4 characters you gain horizontally isn't enough to pay for it.

(I also indent labels, but labels are not common enough for it to become a problem for me, although I suggest C2 code style would be indenting labels as well. Consider defer where the labels inside the defer cannot be jumped to. It would be unsuitable to use them without indent.

@lerno
Copy link
Collaborator

lerno commented Dec 16, 2018

Clang style is still 3 spaces? @bvdberg

@bvdberg
Copy link
Member Author

bvdberg commented Dec 18, 2018

I updated the clang-format file to 4 spaces instead of 3. That matches the current code better and I think 4 spaces is easier on the eyes...

NOTE: I haven't actually applied the clang format file yet..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants