Skip to content
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

Clang format #23

Merged
merged 4 commits into from
Jun 24, 2022
Merged

Clang format #23

merged 4 commits into from
Jun 24, 2022

Conversation

2bndy5
Copy link
Member

@2bndy5 2bndy5 commented Jun 20, 2022

  • add clang-format config file
  • updated CI workflow to check formatting (for all C++ sources including examples)
  • ran clang-format on all C++ sources

Notes

There are some very long inline conditional expressions in the ncurses examples that seem to have gotten a slightly weird formatting. I can tell clang-format to ignore these lines if these changes are undesirable. I think its confusing : for an assignment operator.

     wprintw(rf24Pad, "Data-Rate: %s\n", dr == 0 ? "1MBPS" : dr == 1 ? "2MBPS"
-                                                        : dr == 2	? "250KBPS"
+                : dr == 2                                           ? "250KBPS"
                                                                     : "ERROR");
     int pa = radio.getPALevel();
     wprintw(rf24Pad, "PA Level: %s\n", pa == 0 ? "MIN" : pa == 1 ? "LOW"
-                                                     : pa == 2	 ? "HIGH"
-                                                     : pa == 3	 ? "MAX"
+                : pa == 2                                        ? "HIGH"
+                : pa == 3                                        ? "MAX"
                                                                  : "ERROR");

@TMRh20
Copy link
Member

TMRh20 commented Jun 20, 2022

Works for me either way. I obviously haven't been too picky about formatting. :p

@2bndy5
Copy link
Member Author

2bndy5 commented Jun 20, 2022

I think it was more readable as it was, so I told clang-format to ignore those lines. It really did seem like an error on clang-format's behalf.

@TMRh20 TMRh20 merged commit 4494274 into master Jun 24, 2022
@2bndy5 2bndy5 deleted the clang-format branch June 24, 2022 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants