Skip to content

astyle: remove max line length#25717

Merged
dakejahl merged 1 commit intomainfrom
astyle_length
Oct 15, 2025
Merged

astyle: remove max line length#25717
dakejahl merged 1 commit intomainfrom
astyle_length

Conversation

@dakejahl
Copy link
Copy Markdown
Contributor

@dakejahl dakejahl commented Oct 8, 2025

Opinion
Enforcing line length hurts readability by indenting logical one liners. IMO there isn't much point, I think most people have big monitors and would rather horizontally scroll than having broken up code scattered throughout.

Alternative
Bump to 140

Example
It's especially bad with one-liners that also contain a long comment on the same line
https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/ekf2/EKF2.hpp#L506-L507

@mrpollo
Copy link
Copy Markdown
Contributor

mrpollo commented Oct 8, 2025

I'm ok with this

@hamishwillee
Copy link
Copy Markdown
Contributor

hamishwillee commented Oct 8, 2025

I'm awesome with this. Though there might be a logical reason to have some limit.

EDIT One such logical limit might be how long lines work in github reviews.

@dakejahl
Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @hamishwillee @mrpollo. Doesn't seem like anyone else has any feedback. Approve and merge?

@dakejahl dakejahl enabled auto-merge (squash) October 14, 2025 04:51
@hamishwillee
Copy link
Copy Markdown
Contributor

@MaEtUgR Do you care about this one?

@mrpollo
Copy link
Copy Markdown
Contributor

mrpollo commented Oct 15, 2025

IMO, the limit is a good thing. I have seen people try to be "clever" with one-liners that go beyond the current limit. This is a good way to stop that behavior; however, it's also a bit restrictive for everyone else. Why don't we bump to a higher character limit instead?

@dakejahl
Copy link
Copy Markdown
Contributor Author

IMO the occasional long line is better than crap like this.
https://github.com/PX4/PX4-Autopilot/blob/main/src/modules/ekf2/EKF/common.h#L570-L595

There are also lots examples of one liners that are long by necessity (think class constructor inheritance with templates). My preference is to not chop up code on arbitrary boundaries like line length. I do agree that some people may try to be clever with one-liners that are too long and it would be good to prevent that, but in this case the cure is worse than the disease.

@sfuhrer
Copy link
Copy Markdown
Contributor

sfuhrer commented Oct 15, 2025

I'm in favor of keeping a line length limit, am open to increase it to 140.

@dakejahl dakejahl merged commit 1ca80ae into main Oct 15, 2025
70 of 71 checks passed
@dakejahl dakejahl deleted the astyle_length branch October 15, 2025 20:08
mrpollo pushed a commit that referenced this pull request Nov 24, 2025
Copy link
Copy Markdown
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

Make sense to have a limit and increase it.

MaEtUgR pushed a commit that referenced this pull request Jan 14, 2026
farhangnaderi pushed a commit that referenced this pull request Jan 15, 2026
* astyle: remove max line length (#25717)

* failsafe unit test: add cases for 1 allow taking over from degraded failsafes 2 not cause immediate takeover when failsafe happens because of mode switch

The first test makes sure the user can take over when an RTL failsafe was triggered but degraded to a Land.

The second test rules out the easiest fix of removing the condition `_selected_action == selected_action` which causes the problem for test one but is there for a reason.

* commander/failsafe: fix user takeover not possible in fallback Land action when configured RTL is not possible

---------

Co-authored-by: Jacob Dahl <37091262+dakejahl@users.noreply.github.com>
mbjd pushed a commit that referenced this pull request Feb 17, 2026
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.

5 participants