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

tmp: test clang-tidy #2218

Closed
wants to merge 1 commit into from
Closed

tmp: test clang-tidy #2218

wants to merge 1 commit into from

Conversation

kenji-miyake
Copy link
Contributor

Just testing, don't merge.

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
@kenji-miyake
Copy link
Contributor Author

clang-tidy results on my local machine.

clang-tidy -p build/ -export-fixes /tmp/clang-tidy-result/fixes.yaml src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp
33073 warnings generated.
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:32:14: warning: invalid case style for function 'getGateModeName' [readability-identifier-naming]
const char * getGateModeName(const GateMode::_data_type & gate_mode)
             ^~~~~~~~~~~~~~~
             get_gate_mode_name
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:144:5: warning: uninitialized record type: 'p' [cppcoreguidelines-pro-type-member-init]
    VehicleCmdFilterParam p;
    ^
                           {}
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:156:5: warning: uninitialized record type: 'p' [cppcoreguidelines-pro-type-member-init]
    VehicleCmdFilterParam p;
    ^
                           {}
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:424:59: warning: narrowing conversion from 'double' to 'autoware_auto_control_msgs::msg::LongitudinalCommand_::_acceleration_type' (aka 'float') [cppcoreguidelines-narrowing-conversions]
    filtered_commands.control.longitudinal.acceleration = stop_hold_acceleration_;
                                                          ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:537:37: warning: narrowing conversion from 'double' to 'autoware_auto_control_msgs::msg::AckermannLateralCommand_::_steering_tire_angle_type' (aka 'float') [cppcoreguidelines-narrowing-conversions]
  cmd.lateral.steering_tire_angle = current_steer_;
                                    ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:540:35: warning: narrowing conversion from 'double' to 'autoware_auto_control_msgs::msg::LongitudinalCommand_::_acceleration_type' (aka 'float') [cppcoreguidelines-narrowing-conversions]
  cmd.longitudinal.acceleration = stop_hold_acceleration_;
                                  ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:555:35: warning: narrowing conversion from 'double' to 'autoware_auto_control_msgs::msg::LongitudinalCommand_::_acceleration_type' (aka 'float') [cppcoreguidelines-narrowing-conversions]
  cmd.longitudinal.acceleration = emergency_acceleration_;
                                  ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:618:43: warning: the const qualified parameter 'request_header' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  const std::shared_ptr<rmw_request_id_t> request_header,
                                          ^
                                         &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:619:78: warning: the const qualified parameter 'request' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  const std::shared_ptr<tier4_external_api_msgs::srv::SetEmergency::Request> request,
                                                                             ^
                                                                            &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:620:79: warning: the const qualified parameter 'response' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  const std::shared_ptr<tier4_external_api_msgs::srv::SetEmergency::Response> response)
                                                                              ^
                                                                             &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:638:60: warning: the const qualified parameter 'req_header' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  [[maybe_unused]] const std::shared_ptr<rmw_request_id_t> req_header,
                                                           ^
                                                          &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:639:75: warning: the const qualified parameter 'req' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  [[maybe_unused]] const std::shared_ptr<std_srvs::srv::Trigger::Request> req,
                                                                          ^
                                                                         &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:640:59: warning: the const qualified parameter 'res' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  const std::shared_ptr<std_srvs::srv::Trigger::Response> res)
                                                          ^
                                                         &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:650:60: warning: the const qualified parameter 'req_header' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  [[maybe_unused]] const std::shared_ptr<rmw_request_id_t> req_header,
                                                           ^
                                                          &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:651:75: warning: the const qualified parameter 'req' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  [[maybe_unused]] const std::shared_ptr<std_srvs::srv::Trigger::Request> req,
                                                                          ^
                                                                         &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:652:59: warning: the const qualified parameter 'res' is copied for each invocation; consider making it a reference [performance-unnecessary-value-param]
  const std::shared_ptr<std_srvs::srv::Trigger::Response> res)
                                                          ^
                                                         &
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:672:22: error: method 'checkExternalEmergencyStop' can be made const [readability-make-member-function-const,-warnings-as-errors]
void VehicleCmdGate::checkExternalEmergencyStop(diagnostic_updater::DiagnosticStatusWrapper & stat)
                     ^
                                                                                                    const
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.hpp:196:8: warning: function 'vehicle_cmd_gate::VehicleCmdGate::publishControlCommands' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
  void publishControlCommands(const Commands & input_msg);
       ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:381:22: note: the definition seen here
void VehicleCmdGate::publishControlCommands(const Commands & commands)
                     ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.hpp:196:8: note: differing parameters are named here: ('input_msg'), in definition: ('commands')
  void publishControlCommands(const Commands & input_msg);
       ^                                       ~~~~~~~~~
                                               commands
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.hpp:214:27: warning: function 'vehicle_cmd_gate::VehicleCmdGate::filterControlCommand' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
  AckermannControlCommand filterControlCommand(const AckermannControlCommand & msg);
                          ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp:506:41: note: the definition seen here
AckermannControlCommand VehicleCmdGate::filterControlCommand(const AckermannControlCommand & in)
                                        ^
/home/kenji/autoware/src/universe/autoware.universe/control/vehicle_cmd_gate/src/vehicle_cmd_gate.hpp:214:27: note: differing parameters are named here: ('msg'), in definition: ('in')
  AckermannControlCommand filterControlCommand(const AckermannControlCommand & msg);
                          ^                                                    ~~~
                                                                               in
Error opening output file: No such file or directory

@codecov
Copy link

codecov bot commented Nov 6, 2022

Codecov Report

Base: 11.08% // Head: 11.07% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (b8f6621) compared to base (f7bc465).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2218      +/-   ##
==========================================
- Coverage   11.08%   11.07%   -0.02%     
==========================================
  Files        1202     1202              
  Lines       86198    86359     +161     
  Branches    20706    20815     +109     
==========================================
+ Hits         9559     9560       +1     
- Misses      66546    66693     +147     
- Partials    10093    10106      +13     
Flag Coverage Δ *Carryforward flag
differential 18.86% <ø> (?)
total 11.06% <0.00%> (ø) Carriedforward from f7bc465

*This pull request uses carry forward flags. Click here to find out more.

Impacted Files Coverage Δ
control/vehicle_cmd_gate/src/vehicle_cmd_gate.cpp 0.40% <0.00%> (+0.10%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

⚠️ clang-tidy found issue(s) with the introduced code (1/1)

@@ -149,7 +151,7 @@
p.actual_steer_diff_lim = declare_parameter("nominal.actual_steer_diff_lim", 1.0);
filter_.setParam(p);
}

// tmp
{
VehicleCmdFilterParam p;
Copy link

Choose a reason for hiding this comment

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

⚠️ cppcoreguidelines-pro-type-member-init ⚠️
uninitialized record type: p

Suggested change
VehicleCmdFilterParam p;
VehicleCmdFilterParam p{};

@@ -601,6 +613,7 @@
return dt;
}

// tmp
void VehicleCmdGate::onExternalEmergencyStopService(
const std::shared_ptr<rmw_request_id_t> request_header,
Copy link

Choose a reason for hiding this comment

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

⚠️ performance-unnecessary-value-param ⚠️
the const qualified parameter request_header is copied for each invocation; consider making it a reference

Suggested change
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<rmw_request_id_t>& request_header,

@@ -601,6 +613,7 @@
return dt;
}

// tmp
void VehicleCmdGate::onExternalEmergencyStopService(
const std::shared_ptr<rmw_request_id_t> request_header,
const std::shared_ptr<tier4_external_api_msgs::srv::SetEmergency::Request> request,
Copy link

Choose a reason for hiding this comment

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

⚠️ performance-unnecessary-value-param ⚠️
the const qualified parameter request is copied for each invocation; consider making it a reference

Suggested change
const std::shared_ptr<tier4_external_api_msgs::srv::SetEmergency::Request> request,
const std::shared_ptr<tier4_external_api_msgs::srv::SetEmergency::Request>& request,

@@ -655,6 +668,7 @@
return true;
}

// tmp
void VehicleCmdGate::checkExternalEmergencyStop(diagnostic_updater::DiagnosticStatusWrapper & stat)
Copy link

Choose a reason for hiding this comment

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

⚠️ readability-make-member-function-const ⚠️
method checkExternalEmergencyStop can be made const

Suggested change
void VehicleCmdGate::checkExternalEmergencyStop(diagnostic_updater::DiagnosticStatusWrapper & stat)
void VehicleCmdGate::checkExternalEmergencyStop(diagnostic_updater::DiagnosticStatusWrapper & stat) const

@kenji-miyake
Copy link
Contributor Author

kenji-miyake commented Nov 6, 2022

How to use the clang-tidy-pr-comments-manually workflow added by autowarefoundation/autoware_common#126

Wait for the build-and-test-differential workflow to be completed.

Click Details of any job of the build-and-test-differential.

image

Then, click Summary.

image

I assume that now you are on https://github.com/autowarefoundation/autoware.universe/actions/runs/3406380887 now.

Then, wait for the clang-tidy-differential workflow to be completed and the artifacts to be generated.

image

Trigger the clang-tidy-pr-comments-manually workflow

Open https://github.com/autowarefoundation/autoware.universe/actions/workflows/clang-tidy-pr-comments-manually.yaml and click Run workflow.

Input the run ID (3406380887) or the URL (https://github.com/autowarefoundation/autoware.universe/actions/runs/3406380887 or https://github.com/autowarefoundation/autoware.universe/actions/runs/3406380887/jobs/5665027805) as a user input, and click Run workflow.

image

After the workflow is completed, the bot will comment on the pull request.
Note that not all warnings/errors aren't commented on due to the limitation of the comment feature.

image

@kenji-miyake
Copy link
Contributor Author

FYI @xmfcx

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.

1 participant