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

Update code base formatting #1276

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Conversation

davidscn
Copy link
Member

@davidscn davidscn commented May 2, 2022

Main changes of this PR

Upgrades the clang-format version to clang-format-12, introduces a column limit of 120 as discussed in #1155 and applies corresponding changes to the code base. Resolves #1155. In case anyone has formatting objections, now would be a good time to mention them.

Author's checklist

  • I added a changelog file with make changelog if there are user-observable changes since the last release.
  • I ran make format to ensure everything is formatted correctly.
  • I sticked to C++14 features.
  • I sticked to CMake version 3.16.3.
  • I squashed / am about to squash all commits that should be seen as one.

Reviewers' checklist

  • Does the changelog entry make sense? Is it formatted correctly?
  • Do you understand the code changes?

@davidscn davidscn added this to the Version 2.4.0 milestone May 2, 2022
@davidscn davidscn self-assigned this May 2, 2022
Comment on lines -367 to +319
void precicec_writeBlockScalarData(
int dataID,
int size,
const int * valueIndices,
const double *values);
void precicec_writeBlockScalarData(int dataID, int size, const int *valueIndices, const double *values);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this changes, clang-format resolves the current formatting ambiguity of our code base (e.g. both code versions would have been accepted in our current formatting settings). However, having multiple function arguments on multiple lines might be desirable. Do we want to enforce something line breaks in function arguments or go with the current version?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer one item per line. I find that it makes the signature easier to digest.

Copy link
Member Author

@davidscn davidscn May 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I agree, these arguments

BinPackArguments: false
BinPackParameters: false

would set the arguments on separate lines if they don't fit into the 120 characters. Or do you want to enforce the separate line for all functions (cf the docs)?

@fsimonis
Copy link
Member

fsimonis commented May 5, 2022

Let's move the reformatting behind the 2.4.0 release to avoid breaking at least #1279 #1258 #1271.

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

Successfully merging this pull request may close these issues.

Code formatting ignores line length in documentation, comments and code
4 participants