Skip to content

Commit

Permalink
AStyle: fix indentation for longer lines
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
0xc0170 committed May 24, 2018
1 parent 1059c26 commit f835c89
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .astylerc
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ align-reference=name
# Attach { for classes and namespaces
attach-namespaces
attach-classes

# Extend longer lines, define maximum 120 value. This results in aligned code,
# otherwise the lines are broken and not consistent
max-continuation-indent=120

0 comments on commit f835c89

Please sign in to comment.