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

Tools: Recommend what to do when astyle fails #28557

Merged

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented Nov 8, 2024

Purpose

Tell developers what to do if the astyle check fails.

Motivation

ArduPilot/ardupilot_wiki#6292 (comment)

Demo

This is what a developer will see if they push code and CI fails.

Specifically, we went from:

****** Files needing formatting found.

to:

****** Files needing formatting found. Please run ./Tools/scripts/run_astyle.py

In the screenshot below, I intentionally broke formatting in AP_DDS_Client.h. This is what the script will display in CI.
image

@@ -60,7 +60,7 @@ def check(self):
self.progress("astyle check failed: (%s)" % (ret.stdout))
self.retcode = 1
if "Formatted" in ret.stdout:
self.progress("Files needing formatting found")
self.progress("Files needing formatting found. Please run ./Tools/scripts/run_astyle.py")
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a really strange thing to be printing in run_astyle.py!

If this is intended to make CI clearer, grepping the output of the dry-run might be a better idea.

Copy link
Collaborator Author

@Ryanf55 Ryanf55 Nov 8, 2024

Choose a reason for hiding this comment

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

Is your expectation that we only print this in build_ci.sh? I don't see why we need to grep when we can just check the return code.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, that's my expectation - don't confuse the user who is running this manually.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please look again. I've moved this message to build-ci.sh and check the error code.

@Ryanf55 Ryanf55 marked this pull request as draft November 12, 2024 01:59
@Ryanf55 Ryanf55 force-pushed the astyle-recommend-resolution-after-failure branch from 30e2750 to bb56e9c Compare November 12, 2024 02:07
@Ryanf55 Ryanf55 marked this pull request as ready for review November 12, 2024 02:09
Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

LGTM

@peterbarker peterbarker merged commit 81d1945 into ArduPilot:master Nov 13, 2024
99 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants