-
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
AStyle: Fix astyle indentation #7007
Conversation
This was a bug in our configuration. Earlier versions of our style did not specify this option. We found out for some code in our codebase that it was changed because of the setting. An example: ``` case: { // code here } //would be changed to case: { // code here } ``` The first one is correct and do not need to be indented (it's enough switch is indented).
Long lines like this would have parameters misaligned but shorter lines would be OK. ``` void LoRaMac::check_frame_size(uint16_t size) { uint8_t value = _lora_phy.get_max_payload(_mcps_indication.rx_datarate, - _params.is_repeater_supported); + _params.is_repeater_supported); + + _lora_phy.a(_mcps_indication.b, + b.is_repeater_supported); ``` With this option (applied to the code above), we get ``` @@ -319,6 +319,9 @@ void LoRaMac::check_frame_size(uint16_t size) uint8_t value = _lora_phy.get_max_payload(_mcps_indication.rx_datarate, _params.is_repeater_supported); + _lora_phy.a(_mcps_indication.b, + b.is_repeater_supported); ``` Both are aligned the same. However there is a limit of astyle - 120 columns for this. We do in most cases lines from 80 to 120 as suggested in our code lines thus this should be good.
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.
Looks good.
To bring bigger picture here, with these 2 options, using AStyle 3.1 as recommended this is the outcome to have astyle run for lorawan codebase: https://github.com/ARMmbed/mbed-os/compare/master...0xc0170:test?expand=1 (please review if all is good). It seems to me 👍 |
/morph build |
Build : SUCCESSBuild number : 2207 Triggering tests/morph test |
Test : SUCCESSBuild number : 1999 |
Exporter Build : SUCCESSBuild number : 1833 |
Description
This PR fixes the indentation we identified (thanks @kjbracey-arm @hasnainvirk) in Lorawan PR - lorawan codebase tested astyle to the point where we found that the code astyle was fixing was not correct (see the commit messages with examples how it was and with this config how is it). You will spot the differences.
This PR is vital for astyle applying to our bigger codebase.
Pull request type