Page MenuHomePhabricator

[linter] Match clang-format version from homebrew
ClosedPublic

Authored by Fabien on May 1 2023, 15:22.

Details

Reviewers
tobias_ruck
Group Reviewers
Restricted Project
Commits
rABC6464d6972817: [linter] Match clang-format version from homebrew
Summary

Because homebrew installed clang-format versioning is a bit different, it prevents from checking the correct version is enforced.
Fix the files formatted from later versions due to this bug.

Test Plan
arc lint -- src/crypto/ripmod160.cpp
arc lint --everything

Diff Detail

Repository
rABC Bitcoin ABC
Branch
fix_clang_format_version
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23583
Build 46780: Build Diff
Build 46779: arc lint + arc unit

Event Timeline

Fabien requested review of this revision.May 1 2023, 15:22
Fabien planned changes to this revision.May 1 2023, 15:24
arc lint -- src/crypto/ripemd160.cpp

>>> Lint for src/crypto/ripemd160.cpp:


   Auto-Fix  (CFMT) Code style violation
    '/bitcoin-abc/src/crypto/ripemd160.cpp' has code
    style errors.

              12 namespace {
              13 /// Internal RIPEMD-160 implementation.
              14 namespace ripemd160 {
    >>> -     15     inline uint32_t f1(uint32_t x, uint32_t y, uint32_t z) {
        -     16         return x ^ y ^ z;
        -     17     }
        +            inline uint32_t f1(uint32_t x, uint32_t y, uint32_t z) { return x ^ y ^ z; }
              18     inline uint32_t f2(uint32_t x, uint32_t y, uint32_t z) {
              19         return (x & y) | (~x & z);
              20     }
              21     inline uint32_t f3(uint32_t x, uint32_t y, uint32_t z) {
 OKAY  No lint messages.
$ clang-format --version
clang-format version 12.0.0 (https://github.com/llvm/llvm-project/ b978a93635b584db380274d7c8963c73989944a1)

Fix the wrongly formatted files

Fabien edited the test plan for this revision. (Show Details)
arc lint -- src/crypto/ripemd160.cpp

>>> Lint for src/crypto/ripemd160.cpp:


   Auto-Fix  (CFMT) Code style violation
    '/bitcoin-abc/src/crypto/ripemd160.cpp' has code
    style errors.

              12 namespace {
              13 /// Internal RIPEMD-160 implementation.
              14 namespace ripemd160 {
    >>> -     15     inline uint32_t f1(uint32_t x, uint32_t y, uint32_t z) {
        -     16         return x ^ y ^ z;
        -     17     }
        +            inline uint32_t f1(uint32_t x, uint32_t y, uint32_t z) { return x ^ y ^ z; }
              18     inline uint32_t f2(uint32_t x, uint32_t y, uint32_t z) {
              19         return (x & y) | (~x & z);
              20     }
              21     inline uint32_t f3(uint32_t x, uint32_t y, uint32_t z) {
 OKAY  No lint messages.
$ clang-format --version
clang-format version 12.0.0 (https://github.com/llvm/llvm-project/ b978a93635b584db380274d7c8963c73989944a1)

That's exactly the reason for this diff, I updated the rationale and reformatted the files

Confirmed that using a homebrew installed clang-format@15 now gives me this error:

$ arc lint
Exception 
Linter ClangFormatLinter requires clang-format version 12.x. You have version 15.0.
(Run with `--trace` for a full exception trace.)

arc diff (with clang-format 12) returns OK for me

This revision is now accepted and ready to land.May 1 2023, 15:43

no cpp files change for me here. Still get these changes (FYI)

modified:   contrib/buildbot/cirrus.py
modified:   contrib/buildbot/phabricator_wrapper.py
modified:   contrib/buildbot/server.py
modified:   contrib/buildbot/test/test_endpoint_buildDiff.py
modified:   contrib/buildbot/test/test_endpoint_status.py
modified:   contrib/buildbot/test/test_persist_database.py
modified:   contrib/buildbot/test/test_phabricator.py
modified:   web/explorer/explorer-server/templates/pages/block.html
modified:   web/explorer/explorer-server/templates/pages/blocks.html