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

iox-#889 Fix clang-tidy violations for iceoryx_hoofs package #895

Merged

Conversation

r7vme
Copy link

@r7vme r7vme commented Aug 2, 2021

  1. Fix all clang-tidy-10 violations in iceoryx_hoofs package.
  2. Add CI job run-clang-tidy that runs check (w/o failing as agreed with @dkroenke) for iceoryx_hoofs

To test locally:

  1. Make sure to install clang-tidy-10
  2. ./tools/ci/run-clang-tidy.sh

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-#123-this-is-a-branch)
  5. Commits messages are according to this guideline
    • Commit messages have the issue ID (iox-#123 commit text)
    • Commit messages are signed (git commit -s)
    • Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. Assign PR to reviewer

Notes for Reviewer

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

@codecov
Copy link

codecov bot commented Aug 2, 2021

Codecov Report

Merging #895 (ab305a3) into master (8e2edeb) will increase coverage by 0.43%.
The diff coverage is 70.93%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #895      +/-   ##
==========================================
+ Coverage   75.71%   76.14%   +0.43%     
==========================================
  Files         335      335              
  Lines       12222    12267      +45     
  Branches     2038     2051      +13     
==========================================
+ Hits         9254     9341      +87     
+ Misses       2178     2134      -44     
- Partials      790      792       +2     
Flag Coverage Δ
unittests 75.07% <62.79%> (+0.43%) ⬆️
unittests_timing 29.98% <51.16%> (+0.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...iceoryx_hoofs/internal/file_reader/file_reader.hpp 100.00% <ø> (ø)
...ceoryx_hoofs/include/iceoryx_hoofs/log/logging.hpp 100.00% <ø> (ø)
...hoofs/log/logging_free_function_building_block.hpp 93.33% <0.00%> (ø)
...ryx_hoofs/include/iceoryx_hoofs/log/logmanager.hpp 100.00% <ø> (ø)
...include/iceoryx_hoofs/posix_wrapper/posix_call.hpp 100.00% <ø> (ø)
.../include/iceoryx_hoofs/posix_wrapper/semaphore.hpp 100.00% <ø> (ø)
...ude/iceoryx_hoofs/posix_wrapper/signal_handler.hpp 0.00% <ø> (ø)
iceoryx_hoofs/platform/linux/source/file.cpp 100.00% <ø> (ø)
iceoryx_hoofs/platform/linux/source/fnctl.cpp 100.00% <ø> (ø)
iceoryx_hoofs/platform/linux/source/grp.cpp 100.00% <ø> (ø)
... and 53 more

.clang-tidy Show resolved Hide resolved
@r7vme r7vme force-pushed the iox-#889-fix-clang-tidy-violations branch 10 times, most recently from 1e2ad20 to 5192133 Compare August 5, 2021 12:24
@r7vme r7vme force-pushed the iox-#889-fix-clang-tidy-violations branch 4 times, most recently from b919c49 to 1e2ff41 Compare August 5, 2021 14:59
@r7vme r7vme changed the title WIP iox-#889 Fix clang-tidy violations iox-#889 Fix clang-tidy violations for iceoryx_hoofs package Aug 5, 2021
@r7vme r7vme marked this pull request as ready for review August 5, 2021 15:01
@r7vme
Copy link
Author

r7vme commented Aug 5, 2021

@elBoberido @elfenpiff @dkroenke please take a look this PR fixes clang-tidy violations in iceoryx_hoofs

.clang-tidy Outdated Show resolved Hide resolved
iceoryx_hoofs/source/posix_wrapper/timer.cpp Outdated Show resolved Hide resolved
iceoryx_hoofs/source/posix_wrapper/timer.cpp Outdated Show resolved Hide resolved
iceoryx_hoofs/source/posix_wrapper/unix_domain_socket.cpp Outdated Show resolved Hide resolved
iceoryx_hoofs/source/units/duration.cpp Outdated Show resolved Hide resolved
iceoryx_posh/source/roudi/roudi.cpp Outdated Show resolved Hide resolved
@r7vme r7vme force-pushed the iox-#889-fix-clang-tidy-violations branch 3 times, most recently from e387304 to 6b73bcb Compare August 6, 2021 16:29
@r7vme
Copy link
Author

r7vme commented Aug 6, 2021

@elBoberido @elfenpiff @dkroenke @mossmaurice

Sorry for a huge PR. If you have time please take a look. And I welcome any suggestions.

There is also a new CI job that runs clang-tidy check for iceoryx_hoofs package.

@mossmaurice mossmaurice added the refactoring Refactor code without adding features label Aug 10, 2021
@dkroenke dkroenke mentioned this pull request Aug 13, 2021
3 tasks
@dkroenke dkroenke requested review from dkroenke and elfenpiff August 13, 2021 09:17
@dkroenke dkroenke requested a review from elBoberido August 18, 2021 17:09
CHANGELOG.md Outdated Show resolved Hide resolved
iceoryx_hoofs/source/posix_wrapper/semaphore.cpp Outdated Show resolved Hide resolved
iceoryx_hoofs/source/posix_wrapper/timer.cpp Show resolved Hide resolved
iceoryx_hoofs/source/units/duration.cpp Show resolved Hide resolved
@dkroenke dkroenke force-pushed the iox-#889-fix-clang-tidy-violations branch 2 times, most recently from 173647e to a8b96c1 Compare August 20, 2021 14:40
Copy link
Member

@elBoberido elBoberido left a comment

Choose a reason for hiding this comment

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

Just skimmed over some files and didn't do a thorough review. Is this really a PR with 12858 insertions and 365 removals? I think there is something fishy. Do we maybe have a line ending change?

It would also have been better to create multiple PRs for this since it has quite some changes where small details have a big impact ebeded in an ocean of trivial changes.

Comment on lines 146 to 150
void creationMove(Creation<Class, Error>& lhs, Creation<Class, Error>&& rhs) noexcept
{
using CreationPattern_t = Creation<Class, Error>;
lhs.operator=(std::forward<CreationPattern_t>(rhs));
}
Copy link
Member

@elBoberido elBoberido Aug 21, 2021

Choose a reason for hiding this comment

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

Please don't do it this way. With this you still have to do creationMove(*this, std::move(rhs)) which caused the linter warnings or creationMove(*this, std::move(*static_cast<Creation<Foo>*>(&rhs))) which we want to prevent with this method.

Please rewrite this to

void creationMove(Creation<Class, Error>& rhs)
{
    *this = std::move(rhs);
}

On the caller site this would be just a creationMove(rhs);.

This might cause some warnings though. In this case, please use a macro.

m_name = std::move(rhs.m_name);
m_fd = std::move(rhs.m_fd);
m_fd = rhs.m_fd;
Copy link
Member

Choose a reason for hiding this comment

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

please revert and check that all the code changes doing similar stuff is also reverted

m_name = std::move(rhs.m_name);
// NOLINTNEXTLINE(hicpp-move-const-arg) might break silently if object becomes non-trivial
Copy link
Member

Choose a reason for hiding this comment

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

Are these linter attributes still necessary? If yes, we need to find a solution which makes them obsolete. It's kind of embarrassing to have these in our code base.

@dkroenke
Copy link
Member

@elfenpiff @elBoberido @r7vme I see that this does not make much sense here with this huge PR, too much open topics and clang-tidy exceptions in the code. I propose that this PR goes into draft state until the reviewers have agreed on migration strategy.

@dkroenke dkroenke marked this pull request as draft August 23, 2021 16:33
@elBoberido
Copy link
Member

Maybe some parts can be reverted and and only the non controversial stuff be merged first. The naming for example makes up most of the PR and I think we can all agree on this. Stuff like with the move of the creation pattern should be left out and be done in a follow up.

This PR should then also be squashed before merging else there are huge intermediate changes which mess up history. There are for sure not 12858 additions in this PR. Something is fishy with that.

@dkroenke dkroenke force-pushed the iox-#889-fix-clang-tidy-violations branch 2 times, most recently from da80989 to 40be2bf Compare August 25, 2021 13:05
@dkroenke
Copy link
Member

Maybe some parts can be reverted and and only the non controversial stuff be merged first. The naming for example makes up most of the PR and I think we can all agree on this. Stuff like with the move of the creation pattern should be left out and be done in a follow up.

This PR should then also be squashed before merging else there are huge intermediate changes which mess up history. There are for sure not 12858 additions in this PR. Something is fishy with that.

@elBoberido
The reason for the huge diff was a generated file from a unittest that accidently was committed. I modified the test and added the file to gitignore.
The controversial parts in the move assignment operators are for now excluded from clang-tidy and needs to be addressed later, once an agreement is found.
@elfenpiff This is an agenda point for the next developer meetup.

Maybe that has more chances now.

elfenpiff
elfenpiff previously approved these changes Aug 31, 2021
@dkroenke dkroenke marked this pull request as ready for review September 1, 2021 16:38
@dkroenke dkroenke dismissed elBoberido’s stale review September 1, 2021 16:39

The controversial parts are for now excluded and tracked in the ticket

@mossmaurice mossmaurice removed their request for review September 2, 2021 10:22
Signed-off-by: Dietrich Krönke <dietrich.kroenke@apex.ai>
Ignoring the generated test toml config in git

Signed-off-by: Dietrich Krönke <dietrich.kroenke@apex.ai>
@dkroenke dkroenke merged commit a8c40c4 into eclipse-iceoryx:master Sep 2, 2021
@dkroenke dkroenke deleted the iox-#889-fix-clang-tidy-violations branch September 2, 2021 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Refactor code without adding features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants