Added new bugprone-* and readability-* clang-tidy checks#6363
Conversation
5519e34 to
550239f
Compare
- Add self-assignment checks to 13 operator= methods (bugprone-unhandled-self-assignment) - Add const qualifiers to 12 getter methods (readability-make-member-function-const) - Remove unused RAII temporary in JointIterativeClosestPoint constructor (bugprone-unused-raii)
550239f to
b40a7c3
Compare
There was a problem hiding this comment.
Pull Request Overview
This pull request adds four new clang-tidy checks to the project's configuration and applies the corresponding fixes throughout the codebase. The changes are systematic and address common code quality issues.
Key Changes
- Added bugprone checks for unhandled self-assignment, unused RAII objects, and use-after-move scenarios
- Added readability check to identify member functions that can be marked const
- Applied fixes throughout the codebase including self-assignment guards in copy assignment operators, const qualifiers on getter/setter methods, and removal of an unused RAII object
Reviewed Changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated 13 comments.
Show a summary per file
| File | Description |
|---|---|
| .clang-tidy | Added four new clang-tidy checks: bugprone-unhandled-self-assignment, bugprone-unused-raii, bugprone-use-after-move, and readability-make-member-function-const |
| visualization/src/window.cpp | Added self-assignment check to Window copy assignment operator |
| visualization/include/pcl/visualization/pcl_visualizer.h | Reformatted and added self-assignment check to FPSCallback assignment operator |
| tools/ply2raw.cpp | Added self-assignment check to ply_to_raw_converter assignment operator |
| simulation/src/glsl_shader.cpp | Added const qualifier to multiple setUniform overloads and addShaderFile method |
| simulation/include/pcl/simulation/glsl_shader.h | Added const qualifier to method declarations matching implementation changes |
| segmentation/include/pcl/segmentation/grabcut_segmentation.h | Made getEpsilon() const |
| registration/include/pcl/registration/transformation_estimation_point_to_plane_weighted.h | Added self-assignment checks to three assignment operators |
| registration/include/pcl/registration/transformation_estimation_lm.h | Added self-assignment checks to three assignment operators |
| registration/include/pcl/registration/joint_icp.h | Fixed unused RAII by removing unnecessary base class constructor call |
| recognition/include/pcl/recognition/ransac_based/rigid_transform_space.h | Added self-assignment check to Entry assignment operator |
| outofcore/include/pcl/outofcore/outofcore_iterator_base.h | Added self-assignment check and missing return statement to assignment operator |
| octree/include/pcl/octree/octree_pointcloud_density.h | Made getPointCounter() const |
| octree/include/pcl/octree/octree_base.h | Added self-assignment check to OctreeBase assignment operator |
| octree/include/pcl/octree/octree2buf_base.h | Added self-assignment check to Octree2BufBase assignment operator |
| keypoints/include/pcl/keypoints/agast_2d.h | Made getThreshold() and getMaxKeypoints() const |
| kdtree/include/pcl/kdtree/kdtree_flann.h | Added self-assignment check to KdTreeFLANN assignment operator |
| io/src/openni2/openni2_device.cpp | Added const qualifier to multiple getter methods |
| io/src/hdl_grabber.cpp | Made distance threshold getters const |
| io/src/ensenso_grabber.cpp | Removed trailing whitespace and made several methods const |
| io/include/pcl/io/ply_io.h | Added self-assignment check to PLYReader assignment operator |
| io/include/pcl/io/openni2/openni2_device.h | Updated method declarations to match const implementation |
| io/include/pcl/io/hdl_grabber.h | Updated getter method declarations to const |
| io/include/pcl/io/ensenso_grabber.h | Removed trailing whitespace and updated method declarations to const |
| filters/include/pcl/filters/statistical_outlier_removal.h | Made getter methods const and removed trailing whitespace |
| filters/include/pcl/filters/random_sample.h | Made getSample() and getSeed() const in both filter variants |
| filters/include/pcl/filters/radius_outlier_removal.h | Made getter methods const in both filter variants |
| filters/include/pcl/filters/conditional_removal.h | Added self-assignment check to FieldComparison assignment operator |
| filters/include/pcl/filters/approximate_voxel_grid.h | Added self-assignment check to ApproximateVoxelGrid assignment operator |
| features/src/narf.cpp | Added self-assignment check to Narf assignment operator |
| common/include/pcl/common/bivariate_polynomial.h | Reformatted and added self-assignment check to BivariatePolynomialT assignment operator |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
registration/include/pcl/registration/transformation_estimation_point_to_plane_weighted.h
Show resolved
Hide resolved
registration/include/pcl/registration/transformation_estimation_point_to_plane_weighted.h
Show resolved
Hide resolved
|
The major C++ style guides are unanimous in preferring |
Why didn't you add parentheses then? I think PCL alao does this mostly? |
Crap, I meant exactly the opposite: |
Heh okay. Yeah, from what I could find I agree. Do you have some good links? |
Style Guides:
|
Added new
clang-tidychecks:Ran on Ubuntu 24.04 with this CMake configuration: