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

enable nl_func_call_start_multi_line in uncrustify #210

Merged
merged 1 commit into from
Feb 4, 2020

Conversation

dirk-thomas
Copy link
Contributor

@dirk-thomas dirk-thomas commented Jan 31, 2020

Follow up of #148.

This patch enforces that arguments not fitting in one line must start on a new line (as it is described in the ROS 2 development guide). While that requires quite a bit of existing code to be updated to be compliant the work is easily automated by calling ament_uncrustify --reformat <path>.

Unfortunately nobody on the original ticket was willing to update existing code to comply with the proposed change. So this PR (and the referenced ones) are doing that.

Build Status

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
@dirk-thomas dirk-thomas added the enhancement New feature or request label Jan 31, 2020
@dirk-thomas dirk-thomas self-assigned this Jan 31, 2020
This was referenced Jan 31, 2020
Copy link
Contributor

@jacobperron jacobperron left a comment

Choose a reason for hiding this comment

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

LGTM, with full green CI (linter tests).

wjwwood
wjwwood previously approved these changes Jan 31, 2020
@wjwwood
Copy link
Contributor

wjwwood commented Feb 1, 2020

One thing this does which is not great is it turns things like this:

some_func({
  1,
  2,
});

Into:

some_func(
{
  1,
  2,
});  

Which I think isn't helpful or more correct.

@jacobperron
Copy link
Contributor

I thought that looked a little less good too, but I do think the pro (enforce line-break after paren) outweighs it.

@wjwwood
Copy link
Contributor

wjwwood commented Feb 1, 2020

I thought that looked a little less good too, but I do think the pro (enforce line-break after paren) outweighs it.

I can't say I really agree. I think it's frustrating to do things which don't make sense just because the linter is isn't smart enough to do the desired thing. And in the face of that I'd rather trust the developer and reviewers to get it right.

I approved this pr and several of the connected ones, but honestly I'm not sure it's a step in the right direction. It's a lot of line changes which disrupt backporting and rebasing (for people who maintain patches on top of our code) for a sub-optimal enforcement of the rule...

@dirk-thomas
Copy link
Contributor Author

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status (many test failures - all present in the nightlies)
  • Windows Build Status (unrelated test failures)
  • Windows-container Build Status (job type considered to be broken at the moment)

@wjwwood wjwwood dismissed their stale review February 4, 2020 00:31

Not convinced it is a good direction.

@wjwwood
Copy link
Contributor

wjwwood commented Feb 4, 2020

Why merge some of the pull requests? What if one of the reviews on the remaining repositories turned up something that suggested we shouldn't use this setting?

@jacobperron
Copy link
Contributor

Whether or not we move forward with enabling this rule, it has at least unveiled many instances where we were inconsistent with our style guide. So I think it's still worth fixing those, even though it will cause some churn.

@dirk-thomas dirk-thomas merged commit dbc04bc into master Feb 4, 2020
@delete-merged-branch delete-merged-branch bot deleted the dirk-thomas/nl_func_call_start_multi_line branch February 4, 2020 19:57
@jacobperron
Copy link
Contributor

jacobperron commented Feb 4, 2020

FWIW, I thought that this style was documented in the style guide, but I can't find it. We do document the use of hanging indents for Python code, but not for C++. Considering that the style was prevalent the ROS 2 code base before this change (and now that the violations have been fixed), maybe we should consider adding a line about it to the style guide.

Nevermind. I see the quote in the original ticket. Just missed it.

y-okumura-isp added a commit to y-okumura-isp/rcl that referenced this pull request Feb 6, 2020
for ament/ament_lint#210

Co-Authored-By: Jacob Perron <jacob@openrobotics.org>
jacobperron added a commit to ros-simulation/gazebo_ros_pkgs that referenced this pull request Mar 13, 2020
Style changes to conform to the new default setting introduced in ament/ament_lint#210.
Arguments that do not fit on one line must start on a new line.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
chapulina pushed a commit to ros-simulation/gazebo_ros_pkgs that referenced this pull request Mar 14, 2020
Style changes to conform to the new default setting introduced in ament/ament_lint#210.
Arguments that do not fit on one line must start on a new line.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants