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

Add common linters to tf2 #258

Merged
merged 1 commit into from
Aug 6, 2020
Merged

Add common linters to tf2 #258

merged 1 commit into from
Aug 6, 2020

Conversation

ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Apr 28, 2020

This PR adds common linters. It builds on top of this other PR #257.

  • uncrustify
  • cppcheck
  • cpplint
  • copyright headers

@ahcorde ahcorde added the enhancement New feature or request label Apr 28, 2020
@ahcorde ahcorde requested a review from tfoote April 28, 2020 13:30
@ahcorde ahcorde self-assigned this Apr 28, 2020
@ahcorde
Copy link
Contributor Author

ahcorde commented Apr 28, 2020

I still have some issues with some copyright headers located in tf2/LinearMath. This copyright header is no defined in the templates. Any thoughts about how to include this particular copyrights?

@clalancette
Copy link
Contributor

I still have some issues with some copyright headers located in tf2/LinearMath. This copyright header is no defined in the templates. Any thoughts about how to include this particular copyrights?

Ug. That looks like some kind of MIT derivative, or something. We'll have to do some research on it; for now, I'll suggest that we just disable copyright checking.

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Overall, this looks pretty good. A lot of little nits inline. There are also some bigger things listed below. But since I don't want this PR to get much bigger, please open issues for these so we can follow-up later:

  1. Rename all .h -> .hpp files. This will have to also have a deprecation warning, and should be done post-Foxy.
  2. Go through the comments (particularly API comments) and fix the ones that say todo.
  3. Go through the comments and use a common Doxygen style (some of the comments use \ and some use @).

tf2/include/tf2/LinearMath/Matrix3x3.h Outdated Show resolved Hide resolved
tf2/include/tf2/LinearMath/Matrix3x3.h Outdated Show resolved Hide resolved
tf2/include/tf2/LinearMath/Matrix3x3.h Outdated Show resolved Hide resolved
tf2/include/tf2/LinearMath/QuadWord.h Outdated Show resolved Hide resolved
tf2/include/tf2/LinearMath/Quaternion.h Outdated Show resolved Hide resolved
tf2/include/tf2/time.h Outdated Show resolved Hide resolved
tf2/include/tf2/time_cache.h Show resolved Hide resolved
{
*this = rhs;
}

TF2_PUBLIC
TransformStorage& operator=(const TransformStorage& rhs)
TransformStorage & operator=(const TransformStorage & rhs)
{
#if 01
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a bug. If you don't want to deal with it in this PR, please open an issue to follow-up on it.

tf2/src/buffer_core.cpp Outdated Show resolved Hide resolved
tf2/src/buffer_core.cpp Outdated Show resolved Hide resolved
@ahcorde
Copy link
Contributor Author

ahcorde commented Apr 28, 2020

Thanks for the review! it's quite long the PR.

The issue was created #259

@ahcorde
Copy link
Contributor Author

ahcorde commented Apr 28, 2020

For now I will not remove because it's part of the public API. Maybe in the post-foxy release review.

@ahcorde ahcorde changed the base branch from ahcorde/doc/doxifiles to ros2 April 29, 2020 15:55
@ahcorde ahcorde requested a review from clalancette April 29, 2020 15:58
Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Two more minor things to fix, then I think we're good to go.

One question: in #259, what do you mean by "remove time.h"? I think we added that relatively recently so that people could just get the time conversions, but maybe I'm misremembering. Can you elaborate more on why?

#ifndef TF2__TIME_H_
#define TF2__TIME_H_

#include <stdio.h>
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment about removing stdio.h is still open.

tf2/include/tf2/time.h Outdated Show resolved Hide resolved
@ahcorde
Copy link
Contributor Author

ahcorde commented Apr 29, 2020

I understood the comment wrong. I read that the "file" was not used, not just the #include <stdio.h>. Sorry about that, I updated the issue

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

Looks good with green CI.

@ahcorde
Copy link
Contributor Author

ahcorde commented Apr 29, 2020

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@tfoote
Copy link
Contributor

tfoote commented Apr 29, 2020

I'd really like to not apply the linters to LinearMath files. It's a fork of Bullets LinearMath implementation and we periodically sync between them. Can we suppress the linting in that subdirectory?

@ahcorde
Copy link
Contributor Author

ahcorde commented Apr 30, 2020

For now we can only suppress the linting in uncrustify, but with this PR ament/ament_lint#234 we can suppress them also in cppcheck and cpplint

Copy link
Contributor

@tfoote tfoote left a comment

Choose a reason for hiding this comment

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

Thanks this looks much better with excluding the LinearMath content.

@clalancette
Copy link
Contributor

So, while I think we're good to go here, I would advocate for not merging this PR until after we branch off for foxy. The risk of regression is fairly low, but it's not zero and I think we should let foxy calm down a bit. @ahcorde @tfoote what do you think?

@dirk-thomas
Copy link
Member

Since Foxy will be supported for 3+ years I would highly suggest to not have such a big diff between the Foxy and G-turtle branch.

@clalancette
Copy link
Contributor

Since Foxy will be supported for 3+ years I would highly suggest to not have such a big diff between the Foxy and G-turtle branch.

Why?

@dirk-thomas
Copy link
Member

Because of the extra effort to backport fixes.

@ahcorde
Copy link
Contributor Author

ahcorde commented May 4, 2020

This package is one of the candidates for Quality Level 1 or 2. This means that linters is a must. what's the best way to proceed?

@clalancette
Copy link
Contributor

My opinion hasn't changed; if we keep shoveling stuff into Foxy, then it will never get done.

That being said, if others think we should proceed, then I won't stand in the way.

@tfoote
Copy link
Contributor

tfoote commented May 15, 2020

Clearly it's a risk, but I think continuity with G-Turtle and forward will be more valuable than backwards compatibility with Noetic so the maintenance hopefully will be reduced. We're already pretty diverged from the ROS 1 branch so patches won't just apply across.

Clearly any big change is a risk but this has reasonable coverage so I think it's relatively low especially with it theoretically being just reformatting.

@ros-pull-request-builder retest this please

@ahcorde
Copy link
Contributor Author

ahcorde commented May 18, 2020

@tfoote the pull-request-builder failed this other PR should resolve the issue #267

@ahcorde
Copy link
Contributor Author

ahcorde commented May 19, 2020

@ros-pull-request-builder retest this please

@ahcorde
Copy link
Contributor Author

ahcorde commented May 29, 2020

Testing changes on ament_lint ament/ament_lint#238. Running CI up-to tf2

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette
Copy link
Contributor

I've now rebased and force-pushed this on the latest. It still needs the changes from ament/ament_lint#238 to go in first, though.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
Signed-off-by: ahcorde <ahcorde@gmail.com>
@clalancette clalancette force-pushed the ahcorde/docs/improve branch from dc9126d to dd033ec Compare August 6, 2020 14:59
@clalancette
Copy link
Contributor

I've rebased this onto the latest, and also replaced the actual linting checks with a TODO.

I'd like to go ahead and merge this, since this is going to affect any incoming PRs that touch the tf2 directory. We won't have the actual checks in place until we resolve ament/ament_lint#238 , but it should be a much smaller patch once we do that.

With all of that said, then, here is another CI up to tf2. If this succeeds, I'll merge:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@clalancette clalancette merged commit 7b0f16f into ros2 Aug 6, 2020
@clalancette clalancette deleted the ahcorde/docs/improve branch August 6, 2020 16:56
aprotyas added a commit that referenced this pull request Oct 17, 2021
Each of the common linters were individually `find_package`-d
and invoked in the CMakeLists.txt file. This is because there
is no simple way to pass file exclusion information through
`ament_lint_auto`.

File exclusion is necessary because we do not want to run linters
on the include/tf2/LinearMath/ headers, since these are
external and periodically synced with upstream. See
#258 (comment)
for more information.

Signed-off-by: Abrar Rahman Protyasha <aprotyas@u.rochester.edu>
aprotyas added a commit that referenced this pull request Oct 19, 2021
Each of the common linters were individually `find_package`-d
and invoked in the CMakeLists.txt file. This is because there
is no simple way to pass file exclusion information through
`ament_lint_auto`.

File exclusion is necessary because we do not want to run linters
on the include/tf2/LinearMath/ headers, since these are
external and periodically synced with upstream. See
#258 (comment)
for more information.

Signed-off-by: Abrar Rahman Protyasha <aprotyas@u.rochester.edu>
aprotyas added a commit that referenced this pull request Dec 18, 2021
As discussed in #467:

- Enables a subset of relevant linter tests from `ament_lint_common` in `tf2`.
- Excludes LinearMath headers (include/tf2/LinearMath) from being linted.
- Fixes line-length formatting issues in a few source files, so that there are no lint failures in the current state.

Note that individual linters had to be invoked rather than use `ament_lint_auto` because the LinearMath headers should not have linters run on them - see #258 (comment) for more information - and because `ament_lint_auto` does not provide a general way of providing file exclusion lists.

Signed-off-by: Abrar Rahman Protyasha <aprotyas@u.rochester.edu>
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.

4 participants