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

fix(tier4_state_rviz_plugin): fix unusedFunction #8608

Merged

Conversation

kobayu858
Copy link
Contributor

Description

This is a fix based on cppcheck unusedFunction warnings.

common/tier4_state_rviz_plugin/src/custom_button.cpp:56:0: style: The function 'minimumSizeHint' is never used. [unusedFunction]
QSize CustomElevatedButton::minimumSizeHint() const
^

common/tier4_state_rviz_plugin/src/custom_button.cpp:61:0: style: The function 'updateStyle' is never used. [unusedFunction]
void CustomElevatedButton::updateStyle(
^

common/tier4_state_rviz_plugin/src/custom_button.cpp:74:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomElevatedButton::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_container.cpp:29:0: style: The function 'setCornerRadius' is never used. [unusedFunction]
void CustomContainer::setCornerRadius(int radius)
^

common/tier4_state_rviz_plugin/src/custom_container.cpp:35:0: style: The function 'getCornerRadius' is never used. [unusedFunction]
int CustomContainer::getCornerRadius() const
^

common/tier4_state_rviz_plugin/src/custom_container.cpp:40:0: style: The function 'getLayout' is never used. [unusedFunction]
QGridLayout * CustomContainer::getLayout() const
^

common/tier4_state_rviz_plugin/src/custom_segmented_button.cpp:43:0: style: The function 'getButtonGroup' is never used. [unusedFunction]
QButtonGroup * CustomSegmentedButton::getButtonGroup() const
^

common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp:35:0: style: The function 'setColors' is never used. [unusedFunction]
void CustomSegmentedButtonItem::setColors(
^

common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp:54:0: style: The function 'setHovered' is never used. [unusedFunction]
void CustomSegmentedButtonItem::setHovered(bool hovered)
^

common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp:60:0: style: The function 'setCheckableButton' is never used. [unusedFunction]
void CustomSegmentedButtonItem::setCheckableButton(bool checkable)
^

common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp:74:0: style: The function 'setDisabledButton' is never used. [unusedFunction]
void CustomSegmentedButtonItem::setDisabledButton(bool disabled)
^

common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp:80:0: style: The function 'setActivated' is never used. [unusedFunction]
void CustomSegmentedButtonItem::setActivated(bool activated)
^

common/tier4_state_rviz_plugin/src/custom_container.cpp:43:0: style: The function 'minimumSizeHint' is never used. [unusedFunction]
QSize CustomContainer::minimumSizeHint() const
^
common/tier4_state_rviz_plugin/src/custom_container.cpp:48:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomContainer::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_icon_label.cpp:53:0: style: The function 'minimumSizeHint' is never used. [unusedFunction]
QSize CustomIconLabel::minimumSizeHint() const
^
common/tier4_state_rviz_plugin/src/custom_icon_label.cpp:58:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomIconLabel::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_label.cpp:49:0: style: The function 'minimumSizeHint' is never used. [unusedFunction]
QSize CustomLabel::minimumSizeHint() const
^
common/tier4_state_rviz_plugin/src/custom_label.cpp:54:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomLabel::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_segmented_button.cpp:58:0: style: The function 'minimumSizeHint' is never used. [unusedFunction]
QSize CustomSegmentedButton::minimumSizeHint() const
^
common/tier4_state_rviz_plugin/src/custom_segmented_button.cpp:63:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomSegmentedButton::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_segmented_button_item.cpp:79:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomSegmentedButtonItem::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_slider.cpp:22:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomSlider::paintEvent(QPaintEvent *)
^

common/tier4_state_rviz_plugin/src/custom_toggle_switch.cpp:33:0: style: The function 'paintEvent' is never used. [unusedFunction]
void CustomToggleSwitch::paintEvent(QPaintEvent *)
^

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
@github-actions github-actions bot added the component:common Common packages from the autoware-common repository. (auto-assigned) label Aug 26, 2024
Copy link

github-actions bot commented Aug 26, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
@kobayu858 kobayu858 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 26, 2024
@kobayu858 kobayu858 requested a review from veqcc August 26, 2024 04:39
Copy link

codecov bot commented Aug 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 24.07%. Comparing base (b9b0fa9) to head (476aa0e).
Report is 42 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8608   +/-   ##
=======================================
  Coverage   24.06%   24.07%           
=======================================
  Files        1398     1398           
  Lines      102639   102633    -6     
  Branches    39023    39023           
=======================================
  Hits        24704    24704           
+ Misses      75403    75397    -6     
  Partials     2532     2532           
Flag Coverage Δ *Carryforward flag
differential 0.00% <ø> (?)
total 24.11% <ø> (+0.04%) ⬆️ Carriedforward from 84d3834

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@isamu-takagi
Copy link
Contributor

@kobayu858 I think these are functions called by the Qt framework. Did the UI appearance in rviz remain the same?
@KhalilSelyan Can you check if it is OK to remove these functions for custom widgets?

@KhalilSelyan
Copy link
Contributor

A lot of those have a passive automatic call by Qt that is being overridden by being recreated in the custom component, others are there as these are generic components in case of re-use and being needed later i think it's not necessary to remove them for potential later use in this or other panels @isamu-takagi

@kobayu858 kobayu858 marked this pull request as draft August 27, 2024 06:37
@kobayu858 kobayu858 removed the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 27, 2024
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
@kobayu858 kobayu858 added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Aug 27, 2024
@kobayu858
Copy link
Contributor Author

@isamu-takagi @KhalilSelyan

Thanks for the advice.
I have changed to suppression in the comments about what was actually used.

I removed setCornerRadius, getCornerRadius, and setColors as they do not seem to be used.
The rationale is that they did not look the same in rviz, and as a result of print debugging.

The above three functions are treated as functions that are declared but not defined, such as setContainerWidth, and the declarations are left in hpp.

@kobayu858 kobayu858 marked this pull request as ready for review August 27, 2024 08:35
@isamu-takagi
Copy link
Contributor

@kobayu858 Thank you for updating. Could you please remove the declaration from the header as it would be confusing to readers? The other parts are fine.

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
@kobayu858
Copy link
Contributor Author

@isamu-takagi
Thank you for the advice. I have removed the header declaration.

Copy link
Contributor

@isamu-takagi isamu-takagi left a comment

Choose a reason for hiding this comment

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

LGTM

@kobayu858 kobayu858 merged commit bda8706 into autowarefoundation:main Aug 28, 2024
31 checks passed
a-maumau pushed a commit to a-maumau/autoware.universe that referenced this pull request Sep 2, 2024
…8608)

* fix:unusedFunction

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:clang format

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom button

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom container

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom icon label

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom label

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom segment button

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom slider

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom toggle switch

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom label

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:add blank line

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom botton item

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:remove declaration

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

---------

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
ktro2828 pushed a commit to ktro2828/autoware.universe that referenced this pull request Sep 18, 2024
…8608)

* fix:unusedFunction

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:clang format

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom button

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom container

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom icon label

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom label

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom segment button

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom slider

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom toggle switch

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom label

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:add blank line

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:revert custom botton item

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

* fix:remove declaration

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>

---------

Signed-off-by: kobayu858 <yutaro.kobayashi@tier4.jp>
@kobayu858 kobayu858 deleted the fix/cppcheck_unusedFunction_com-19 branch October 1, 2024 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:common Common packages from the autoware-common repository. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants