Skip to content

Conversation

dakejahl
Copy link
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
Contributor

mrpollo commented Oct 8, 2025

I'm ok with this

@hamishwillee
Copy link
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
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
Contributor

@MaEtUgR Do you care about this one?

@mrpollo
Copy link
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
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
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
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.

4 participants