-
Notifications
You must be signed in to change notification settings - Fork 214
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
Linting for rviz_rendering #17
Conversation
// copyright notice, this list of conditions and the following | ||
// disclaimer in the documentation and/or other materials provided | ||
// with the distribution. | ||
// * Neither the name of the Open Source Robotics Foundation, Inc. nor the names of its |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is the right change because Willow Garage's name should still not be used (nothing has changed in that respect).
The updated 3-clause bsd template uses a more general statement here:
Neither the name of the copyright holder nor the names of its contributors may be used to endorse
-- https://choosealicense.com/licenses/bsd-3-clause/
We should probably update to that instead.
Also there is a pull request I am looking into that should allow us to use the block comments rather than //
comments, letting us have smaller diffs:
So if you want to merge this, for now I would suggest disabling the copyright linter and wait for that pr to get merged before trying to enable it again. Otherwise I am going to wait to merge this pr until we have that sorted out because I really don't want to have a diff like this in all the files we port.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree - it would be much better to have ament_lint copyright check be able to work with block comments. If this happens soon, I'll be inclined to wait for it. Otherwise, I can also disable it if you want.
Regarding the change, I wasn't sure (that's why it's in a separate commit) - it just seemed logical because the file has no connection whatsoever to Willow Garage.
The template I chose was the one recognized by ament_lint - see here: https://github.com/ament/ament_lint/tree/master/ament_copyright/ament_copyright/template
- the weird part I only saw now is that the license template is equivalent to the bsd-3-clause you mention, while the license header isn't - and ament_copyright checks for the header.
|
||
void OgreLogging::useLogFile(const std::string & filename) | ||
{ | ||
preference_ = FileLogging; | ||
filename_ = filename; | ||
filename_ = filename.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not safe, as the lifetime of filename
is not guaranteed to be longer than filename_
, that's why I just disable the linter on this one until that is resolved some other way. You can either leave the NOLINT or fix it another way.
@@ -124,6 +127,7 @@ void OgreLogging::configureLogging() | |||
if (preference_ == StandardOut) { | |||
ll.min_lml = Ogre::LML_NORMAL; | |||
} | |||
delete log_manager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't believe this to be correct either. I think the logger will be held by Ogre::LogManager::getSingletonPtr()
afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking into it, you're absolutely right. I find this quite weird style, though: I would've expected there to be some kind of static factory method instead - if I new
an object, this should mean I'm also responsible to delete
it. I guess we have to disable cppcheck for this new
call then. I'll look into it.
@@ -60,7 +61,7 @@ get_resource_directory() | |||
void | |||
set_resource_directory(const std::string & resource_directory) | |||
{ | |||
__resource_directory = resource_directory; | |||
__resource_directory = resource_directory.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not safe either, for the reasons described above.
@@ -72,7 +73,7 @@ get_ogre_plugin_directory() | |||
void | |||
set_ogre_plugin_directory(const std::string & ogre_plugin_directory) | |||
{ | |||
__ogre_plugin_directory = ogre_plugin_directory; | |||
__ogre_plugin_directory = ogre_plugin_directory.c_str(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same.
- we don't use ament_lint_common because copyright checks fail - we want to wait for changes in ament_copyright before fixing
- only one error: memory leak of log_manager
- SdkQtCameraMan is from OgreBites and not from rviz - No change in functionality
0cc10d8
to
bfcdc73
Compare
I updated the pull request making all requested changes (to simplify things, I force-pushed):
One additional comment: It would be nicer to still use ament_lint_auto with custom linting tools as specified in https://github.com/ament/ament_lint/blob/master/ament_lint_auto/doc/index.rst - but this didn't work for me, so I had to include the linters manually in CMake. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, I added a todo for the copyright linter and a comment about the delete-less free.
Interesting, perhaps it's worth opening an issue on the ament_lint_auto package's repository. This will work fine for now. |
I don't know if it helps but you can bypass a specific linter by tricking cmake into not finding it and keep using ament_lint_auto for everything else (example to disable only the copyright linter here) |
* Introduce linters in rviz_rendering - we don't use ament_lint_common because copyright checks fail - we want to wait for changes in ament_copyright before fixing * Fix cppcheck errors - only one error: memory leak of log_manager * Extract SdkQtCameraMan from OgreBites to fix linters - SdkQtCameraMan is from OgreBites and not from rviz - No change in functionality * adding a todo about the copyright linter * add a comment about delete-less new call
This pull request adds liniting to rviz_rendering and fixes all linting issues to have a clean build.
Closes #1