Skip to content

Conversation

@joyeecheung
Copy link
Member

This is how the clang-format file in #21997 styles the $LINT_CPP_FILES. It's just a preview, so please ignore it if you are not curious about how the styles enforced in #21997 look like.

Produced with

tools/clang-format/node_modules/.bin/clang-format -i --style=file $(LINT_CPP_FILES) 
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. lib / src Issues and PRs related to general changes in the lib or src directory. labels Jul 27, 2018
@addaleaxaddaleax added the blocked PRs that are blocked by other issues or PRs. label Jul 27, 2018
This patch adds a `make format-cpp` shortcut to the Makefile that runs clang-format on the C++ diffs, and a `make format-cpp-build` to install clang-format from npm. To format staged changes: ``` $ make format-cpp ``` To format HEAD~1...HEAD (latest commit): ``` $ CLANG_FORMAT_START=`git rev-parse HEAD~1` make format-cpp ``` To format diff between master and current branch head (master...HEAD): ``` $ CLANG_FORMAT_START=master make format-cpp ``` Most of the .clang-format file comes from running ``` $ clang-format --dump-config --style=Google ``` with clang-format built with llvm/trunk 328768 (npm version 1.2.3) The clang-format version is fixed because different version of clang-format may format the files differently.
@joyeecheungjoyeecheungforce-pushed the clang-format-diff-result branch from a6b3e3a to 8bf9df6CompareAugust 1, 2018 09:37
@joyeecheungjoyeecheungforce-pushed the clang-format-diff-result branch from 3babcbc to 189cd50CompareAugust 1, 2018 10:02
classAliasedBuffer{
public:
AliasedBuffer(v8::Isolate* isolate, constsize_t count)
: isolate_(isolate),
Copy link
Member

Choose a reason for hiding this comment

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

i feel like this was more readable before

Copy link
Member

Choose a reason for hiding this comment

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

This is ConstructorInitializerAllOnOneLineOrOnePerLine. There is apparently no option to force one per line.

return *this = static_cast<NativeT>(val);
}

operatorNativeT() const{
Copy link
Member

Choose a reason for hiding this comment

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

can we have return always on a new line?


template <typename TypeName>
size_tbase64_decoded_size(const TypeName* src, size_t size){
if (size == 0)
Copy link
Member

Choose a reason for hiding this comment

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

return on new line

Boolean::New(env->isolate(), readable),
Boolean::New(env->isolate(), writable)
};
Local<Value> argv[5] ={Integer::New(env->isolate(), status),
Copy link
Member

Choose a reason for hiding this comment

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

ouch

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

@devsnek Yeah I thought it looked strange but then this came from Google's style and in the documentation they argued this is more suited for C++11 (This is named Cpp11BracedListStyle)

@joyeecheung
Copy link
MemberAuthor

I think this PR has run its course. Closing...

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blockedPRs that are blocked by other issues or PRs.c++Issues and PRs that require attention from people who are familiar with C++.lib / srcIssues and PRs related to general changes in the lib or src directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@joyeecheung@nodejs-github-bot@targos@devsnek@addaleax