This repository was archived by the owner on Dec 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 105
Cleanup/enforce formatting #531
Open
robszewczyk
wants to merge
13
commits into
openweave:master
Choose a base branch
from
robszewczyk:cleanup/enforce-formatting
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cc03258
Add a script to format code
robszewczyk 5dc3ada
Changes to clang-format style file
robszewczyk 0722b37
Better support for managed namespaces in clang
robszewczyk 825c7b3
Preserve original formatting in adaptations, ble, device-manager, ine…
robszewczyk 5a83b12
Preserve original formatting in src/lib/core
robszewczyk 356eb1e
Make doxygen style consistent in NetworkInfo.h
robszewczyk 150d884
Preserve original formatting in profiles/{echo|device-description|dev…
robszewczyk 7db5ba7
Preserve original formating in profiles/{fabric-provisioning|heartbeat}
robszewczyk deec987
Preserve block formatting in weave security profile
robszewczyk d0f0972
Preserve the original block formatting in profile/service-directory
robszewczyk c082e6c
Preserve block-oriented formatting in profiles/{service-provisioning|…
robszewczyk a948c12
Preserve original formatting for profiles/weave-tunneling
robszewczyk c0a73dd
Preserve block formatting in profiles/data-management
robszewczyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/bin/sh | ||
|
|
||
| SED=/bin/sed | ||
| PERL=/usr/bin/perl | ||
| CLANGFORMAT=clang-format-9 | ||
|
|
||
| FILENAME=${1} | ||
|
|
||
| # do anything iff we have clang-format | ||
| if ! clang-format -version; then | ||
| echo "Missing clang-format, please install it prior to reformatting the code" | ||
| exit 1 | ||
| fi | ||
| # clang format has difficulty recognizing the | ||
| # WeaveMakeManagedNamespaceIdentifier() macro as a valid namespace; | ||
| # temporarily change the namespace name to something more palatable to | ||
| # clang-format | ||
|
|
||
| sed -i -e 's:^[ ]*namespace[ ]\+WeaveMakeManagedNamespaceIdentifier(\([^ ,()]\+\),[ ]*\([^ ,()]\+\))[ ]*{[ ]*$:namespace WeaveMakeManagedNamespaceIdentifier_\1_\2 {:g' ${FILENAME} | ||
|
|
||
| ${CLANGFORMAT} -i -style=file ${FILENAME} | ||
|
|
||
| sed -i -e 's:namespace WeaveMakeManagedNamespaceIdentifier_\([^_]\+\)_\([^ ]\+\):namespace WeaveMakeManagedNamespaceIdentifier(\1, \2):g' ${FILENAME} | ||
|
|
||
| # clang formatter does not seem to provide an option to insert a space into the empty expression i.e., {}, so we hit this with sed | ||
| sed -i -e 's:{}:{ }:g' ${FILENAME} | ||
| sed -i -e 's:;):; ):g' ${FILENAME} | ||
|
|
||
| # weave prefers to separate the keyword operator from the operator itself | ||
| sed -i -e 's:operator\([-+/*|&=~!%<>[(]\):operator \1:g' ${FILENAME} | ||
|
|
||
| #space before the opening brace in short functions | ||
| sed -i -e 's:){:) {:g' ${FILENAME} | ||
| sed -i -e 's:({:( {:g' ${FILENAME} | ||
|
|
||
| sed -i -e 's:\(.\)\([^ "@]\){:\1\2 {:g' ${FILENAME} |
10,388 changes: 5,194 additions & 5,194 deletions
10,388
src/adaptations/device-layer/TestDeviceIds.cpp
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of enforcing prefix documentation for inline definitions? This is particularly onerous on readability.
I see a lot of places in this PR where the requirement is suppressed. If we don't like the way it looks, then why would we turn it on in the first place?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was one of the first files I changed, and I was still evolving a style. In a few places earlier on I thought the right path forward was to switch to prefix and rely on the clang format down the road. As the set of changes evolved, I've started using the
// clang-format offdirective more easily and I am happy to make those changes.