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

Better CI Format Check #466

Merged
merged 2 commits into from
Aug 7, 2023
Merged

Better CI Format Check #466

merged 2 commits into from
Aug 7, 2023

Conversation

nosracd
Copy link
Contributor

@nosracd nosracd commented Aug 5, 2023

Different versions of clang-format format differently. The CI uses clang-format-12 for consistency, but format_code.sh does not specify a version. This can result in situations where format_code.sh reports well-formatted code locally but not on the CI, such as in this case.

b1c8fec remedies this by forcing format_code.sh to use clang-format-12 and instructing the user to install that particular version if it's not available.

Unfortunately, this means that some people are much older or newer distributions might not be able to use the formatter locally. While docker is always an option, 6932d24 attempts to ease this pain by printing the desired format on the CI (example CI success, example CI failure).

@nosracd nosracd requested a review from ihilt August 5, 2023 07:03
@nosracd nosracd mentioned this pull request Aug 5, 2023
@nosracd nosracd self-assigned this Aug 5, 2023
@tprk77 tprk77 self-requested a review August 7, 2023 14:30
format_code.sh Outdated
| xargs clang-format -i
| xargs clang-format-12 -i
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a small refactor, it might be good to use a constant for this. For example, put CLANG_FORMAT="clang-format-12" somewhere at the top and do | xargs $CLANG_FORMAT -i here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me! 0efd380

@nosracd nosracd merged commit 24ec55a into lcm-proj:master Aug 7, 2023
11 checks passed
@nosracd nosracd deleted the ci/better_format branch August 7, 2023 23:41
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.

3 participants