-
Notifications
You must be signed in to change notification settings - Fork 3k
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
features: fix coding style #8591
Conversation
Need to find these 66 files 👀 |
Initial feedback for files changed here: @ARMmbed/mbed-os-storage Please review your features here and let me know what can be run through astyle (I used .astyleignore paths to ignore), so if files here are changed, means I need to rerun it with updated ignored folders. |
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.
Already too many comments and I'm not half way in for BLE. Astyle is very dumb for some constructs.
features/FEATURE_BLE/ble/ArrayView.h
Outdated
@@ -102,8 +103,8 @@ struct ArrayView { | |||
* @post a call to size() will return Size, and data() will return | |||
* a pointer to elements. | |||
*/ | |||
ArrayView(T (&elements)[Size]): | |||
_array(elements) { } | |||
ArrayView(T(&elements)[Size]): |
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.
Astyle nonsense:
ArrayView(T(&elements)[Size]): | |
ArrayView(T (&elements)[Size]): |
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 is known.
We need to turn off astyle for any template magic, similar in Span class and others. I'll fix that . Thanks for the pointers !
Main question - is there any BLE code that should be excluded apart from this errors?
features/FEATURE_BLE/ble/ArrayView.h
Outdated
@@ -203,7 +204,7 @@ struct ArrayView<T, ARRAY_VIEW_DYNAMIC_SIZE> { | |||
* a pointer to elements. | |||
*/ | |||
template<size_t Size> | |||
ArrayView(T (&elements)[Size]): | |||
ArrayView(T(&elements)[Size]): |
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.
Astyle nonsense:
ArrayView(T(&elements)[Size]): | |
ArrayView(T (&elements)[Size]): |
features/FEATURE_BLE/ble/ArrayView.h
Outdated
@@ -333,7 +334,7 @@ bool operator!=(const ArrayView<T, LhsSize>& lhs, const ArrayView<T, LhsSize>& r | |||
* created 'inline'. | |||
*/ | |||
template<typename T, size_t Size> | |||
ArrayView<T, Size> make_ArrayView(T (&elements)[Size]) | |||
ArrayView<T, Size> make_ArrayView(T(&elements)[Size]) |
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.
Astyle nonsense:
ArrayView<T, Size> make_ArrayView(T(&elements)[Size]) | |
ArrayView<T, Size> make_ArrayView(T (&elements)[Size]) |
features/FEATURE_BLE/ble/ArrayView.h
Outdated
@@ -389,7 +390,7 @@ ArrayView<T> make_ArrayView(T* array_ptr, size_t array_size) | |||
* created 'inline'. | |||
*/ | |||
template<typename T, size_t Size> | |||
ArrayView<const T, Size> make_const_ArrayView(T (&elements)[Size]) | |||
ArrayView<const T, Size> make_const_ArrayView(T(&elements)[Size]) |
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.
Astyle nonsense:
ArrayView<const T, Size> make_const_ArrayView(T(&elements)[Size]) | |
ArrayView<const T, Size> make_const_ArrayView(T (&elements)[Size]) |
features/FEATURE_BLE/ble/BLE.h
Outdated
@@ -471,7 +473,8 @@ class BLE | |||
MBED_DEPRECATED("Use ble.gap().getAddress(...)") | |||
ble_error_t getAddress( | |||
BLEProtocol::AddressType_t *typeP, BLEProtocol::AddressBytes_t address | |||
) { | |||
) | |||
{ |
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.
Why ?
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.
{
for functions is not attached
descriptors, | ||
numDescriptors | ||
) { | ||
uuid, |
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.
same as above.
descriptors, | ||
numDescriptors | ||
) { | ||
uuid, |
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.
same as above.
descriptors, | ||
numDescriptors | ||
) { | ||
uuid, |
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.
same as above.
numDescriptors, | ||
false | ||
) { | ||
uuid, |
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.
same as above.
descriptors, | ||
numDescriptors | ||
) { | ||
uuid, |
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.
same as above.
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.
Already too many comments and I'm not half way in for BLE. Astyle is very dumb for some constructs.
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.
LoRaWAN and Cellular are fine
@AnttiKauppila Thank you! @pan- I left one comment above, and will review all instances of BLE issues (If it makes easier, I can send separate PR). Let me know what would be the best approach for BLE code. |
Instead of making exceptions and fixing errors one by one maybe it would be worth it to come up with a set of astyle rules that you agree on? Most of the changes here could be fixed with a config change. Not all though but AStyle is open source and reasonably easy to modify. Vincent's function call and declaration style will probably require code modification to be applied and/or retained. |
Already done via the config file we have - if you spot we are missing something, we can fix it.
I am not certain we can fix easily the above (*,&,&&). From the experience, some code use different formatting than what we have in the config and astyle formats it wrongly anyway - manual update resolves it. I'll review all the review comments soon |
Some of these seem to be caused by unpad-paren not being clever enough. Sadly there is no unpad-paren-in |
The strength of astyle is that's easy to modify because it's so simple but the drawback of astyle is that it's so simple and doesn't understand the code it's styling. There are some alternatives that are more langauge aware. When I got frustrated with astyle I switched to https://github.com/uncrustify/uncrustify. Using http://universalindent.sourceforge.net/ you could recreate the existing astyle config very quickly and then improve on it as uncrustify has more fine grained options and doesn't have the same bugs astyle has. Apologies if this was already considered in the past. |
Instead of focusing on the tool itself (thanks for the tip - haven't used it previously, we shall review uncrustify and clang format for future use. We need to work with the tools we have now), lets focus on the code and tools we have been using. Most of the review comments are related to the hard character limit - in this case 80 (lines are split). We haven't enforced this limit (our coding style suggested 120 but not enforced) thus would suggest reformat the code we identified - should be quick to do (run astyle and review as done here) and would align with the rest of the codebase (look at lorawan, had similar style issues). This should fix most of the issues that we identified here (multiline typedef, parameters to the object ctor and similar). If you got any other suggestions, lets discuss it in the new PR. I suggest removing BLE from here, create a new PR and reformat the code - done by @ARMmbed/mbed-os-pan team as they have better understanding of the codebase. I'll stash my changes for BLE just in case but will push an update to exclude BLE here in this pull request. Lets focus on the rest of features here |
2a33356
to
bc87df5
Compare
Done , BLE feature excluded (added to the astyleignore file), will be fixed via separate PR. |
Added also cleanup for the rest of the codebase (to check that ignore folders are also up to date, added new ignore folders) and this is now ready for review!
Most probably master and its ignore not up to date. I run astyle on entire codebase, all files should be resolved with this pull request (besides what we merge in the meantime) |
@ARMmbed/mbed-os-storage Please review features/storage changes The rest of changes are minimal update should be sufficient to be reviewed by @ARMmbed/mbed-os-maintainers |
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.
I can't look too closely, but storage looks reasonable to me (not much advanced c++ there)
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.
Storage changes look good. Thanks for this change.
a8ab639
to
9fbc184
Compare
Will be reverted once upstream changes come to Mbed OS
aa92a92
to
20646d3
Compare
/morph build |
I rebased to resolve one bad rebase, this is going alone (no rollup) |
Build : FAILUREBuild number : 3579 |
CI issues in the last failures, we are investigating |
/morph build |
Build : SUCCESSBuild number : 3584 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 3194 |
Test : FAILUREBuild number : 3358 |
Test timeout appears spurrious. Will retest when able. |
/morph test |
Test : SUCCESSBuild number : 3362 |
All green 🍏 💚 ready for integration! |
Description
AStyle run on all features that we have (ignored folders are not being checked). This needs further work (we might not have ignore folders up to date, or some features might need update upstream). Let's review what can be updated and how.
I'll add reviewers with questions about the features and its style (some might need some edits).
Pull request type