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

Inconsistent formatting before and after braces in source files #29936

Closed
Anutrix opened this issue Jun 20, 2019 · 6 comments
Closed

Inconsistent formatting before and after braces in source files #29936

Anutrix opened this issue Jun 20, 2019 · 6 comments

Comments

@Anutrix
Copy link
Contributor

Anutrix commented Jun 20, 2019

Godot version:
Godot master branch d6f8a43

Issue description:
What happened:
Inconsistency 1. Source files sometimes do and sometimes don't seem to have newlines after each function's ending brace.(Marked blue in screenshot).
Inconsistency 2. Source files sometimes do and sometimes don't seem to have newlines after each function's starting brace.(Marked red in screenshot).
What should happen:
Consistent styles regarding above.

Steps to reproduce:
Search sources files.
e.g, Lines after texture.cpp:1155 show an example the 2 formatting inconsistencies.

Minimal reproduction project:

Capture45

Can clang-format do anything about it?

@Anutrix Anutrix changed the title Inconsistent newline formatting before and after braces in source files Inconsistent formatting before and after braces in source files Jun 20, 2019
@Xrayez
Copy link
Contributor

Xrayez commented Jun 20, 2019

  1. I'd make this consistent by having space between functions indeed.
  2. Having an empty space in function body allows to add more code easily. Also if there's no space, the code bleeds into the function signature making it somewhat difficult to comprehend, but that might also depend on the line spacing defined by font used.

@akien-mga
Copy link
Member

akien-mga commented Jun 20, 2019

  1. is a habit of @reduz to group setters and getters together this way. It's not used consistently and does not provide so much value, so I'd be fine enforcing a line between all methods if there's a way to do so. I don't recall a clang-format option for that sadly.

  2. also comes from @reduz's original coding style which most of us got used to and use ourselves, though it's also not used consistently and hard to enforce one way or another. The space makes the function signature stand out and makes it clear where the body of the function starts. One could also use the opening bracket on that line for a similar effect, but that's a whole can of worms I'm not willing to open (and I'm not in favor of changing our brace style anyway).
    This one could be changed with KeepEmptyLinesAtTheStartOfBlocks: false in .clang-format. It would have a pretty big impact on the style we're used to though.

@Anutrix
Copy link
Contributor Author

Anutrix commented Jun 21, 2019

Is it Ok if I do it manually or using some scripts and make pull request(s)?
It might be better to do this over many pull requests as changes might be large. And doing it over many updates might let us do it more safely.

@akien-mga
Copy link
Member

Not until we reach a consensus on whether a given style should be enforced.

@YeldhamDev
Copy link
Member

Related: #16521

@akien-mga
Copy link
Member

Superseded by #33027.

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

5 participants