build: run clang-format on CI#42681
Conversation
|
Review requested:
|
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]>
Signed-off-by: Darshan Sen <[email protected]>
6c3f55c to
acfed40
Compare
Signed-off-by: Darshan Sen <[email protected]>
|
Not a blocking comment, but for reviewers who may not be aware:
Refs: #42665 (comment) |
|
Doesn't it only affect the changed lines? |
Yes, that's the intent. |
I was under the impression that it only affects changed files, but is it actually only the changed lines in those files? If so, I didn't realize it was that granular. That's very helpful in this situation. |
|
I think the answer is "no" but just to make sure: Will we want to start checking in the |
Yes, that's right. It was one of the key points that made #21997 a better approach than #16122.
Did you get a chance to go through the demo I edited into the PR description?
Running Lines 1443 to 1444 in 0c57a37 |
That works for me. |
|
Needed another approval because I committed #42681 (comment) after the last review. |
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: nodejs#42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
|
Is the failure in #42701 related to this change? The output is not particularly helpful: |
|
@tniessen You mean in #42701? Hmm, the error looks different from what I got in this PR (as you can see in the description, it is supposed to print the diff and also print the command you can run to fix it locally). 👀 |
|
Oops, yes, that's what I mean :) I did that, seems to pass now. |
According to the logs in nodejs#42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: nodejs#42681 (comment) Signed-off-by: Darshan Sen <[email protected]>
Since we run the formatter only on PRs that are targetting the master branch, let's specify that. Refs: nodejs#42681 (comment) Signed-off-by: Darshan Sen <[email protected]>
Since we run the formatter only on PRs that are targeting the master branch, let's specify that. Refs: nodejs#42681 (comment) Signed-off-by: Darshan Sen <[email protected]>
Since we run the formatter only on PRs that are targeting the master branch, let's specify that. Refs: nodejs#42681 (comment) Signed-off-by: Darshan Sen <[email protected]>
According to the logs in #42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: #42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: nodejs#42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
According to the logs in nodejs#42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: nodejs#42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: nodejs#42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
According to the logs in #42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: #42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
According to the logs in #42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: #42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
According to the logs in #42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: #42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
According to the logs in #42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: #42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
According to the logs in #42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: #42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: #42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside tools/clang-format, so we should start using it on CI. This attempts to run the linter only on the commits present in an opened PR. Signed-off-by: Darshan Sen <[email protected]> PR-URL: nodejs/node#42681 Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: James M Snell <[email protected]>
According to the logs in nodejs/node#42681 (comment), `make format-cpp` exits with an NZEC. This change intentionally ignores the error code because it is irrelevant. We already check if the formatter produced a diff in the next line. Refs: nodejs/node#42681 (comment) Signed-off-by: Darshan Sen <[email protected]> PR-URL: nodejs/node#42764 Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: Mestery <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
We already include the tool inside
tools/clang-format, so we shouldstart using it on CI. This attempts to run the linter only on the
commits present in an opened PR.
Demo
The diff in acfed40:
triggers the clang-format linter and it fails the CI run with this error: https://github.com/nodejs/node/runs/5960445927?check_suite_focus=true
Formatting C++ diff from 6d4b01774bfaa319e3c7a9f1a3165a4d3641ec84.. changed files: src/crypto/crypto_context.cc diff --git a/src/crypto/crypto_context.cc b/src/crypto/crypto_context.cc index 4faff290cf..739b559c3b 100644 --- a/src/crypto/crypto_context.cc +++ b/src/crypto/crypto_context.cc @@ -55,7 +55,7 @@ static bool extra_root_certs_loaded = false; BIOPointer LoadBIO(Environment* env, Local<Value> v) { HandleScope scope(env->isolate()); - if (v-> IsString()) { + if (v->IsString()) { Utf8Value s(env->isolate(), v); return NodeBIO::NewFixed(*s, s.length()); } ERROR: Please run: CLANG_FORMAT_START="$(git merge-base HEAD <target-branch-name>)" make format-cpp to format the commits in your branch.. Accepting the suggested change in abfa103 produces a green CI - https://github.com/nodejs/node/runs/5960458481?check_suite_focus=true.
Signed-off-by: Darshan Sen [email protected]