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

Introduce new error category that is not handled by the ignore list #9386

Merged
merged 1 commit into from
Jan 26, 2022

Conversation

TheOneRing
Copy link
Member

Fixes: #9382

The filter menu will now be sorted by the localised string.
image

@TheOneRing TheOneRing requested a review from a team January 25, 2022 15:16
};
std::vector<std::pair<QString, SyncFileItem::Status>> otherStatusItems;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment that describes the data structure (i.e., what the first and second items in the pair mean).

Copy link
Member Author

Choose a reason for hiding this comment

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

LIke

 // list of OtherStatusItems with the localised name
    std::vector<std::pair<QString, SyncFileItem::Status>> otherStatusItems;
    otherStatusItems.reserve(OtherStatusItems.size());
    for (const auto &item : OtherStatusItems) {
        otherStatusItems.emplace_back(SyncFileItem::statusEnumDisplayName(item), item);
    }

Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't get that the first couple of times I was reading this code. Perhaps you should reverse the order in the pair?

@@ -64,23 +64,48 @@ void LocalDiscoveryTracker::slotItemCompleted(const SyncFileItemPtr &item)
//
// For failures, we want to add the file to the list so the next sync
// will be able to retry it.
Copy link
Member Author

Choose a reason for hiding this comment

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

As this is right out of hell, please read carefully

Copy link
Contributor

@dragotin dragotin left a comment

Choose a reason for hiding this comment

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

Two little comments...

if (item->_instruction != CSYNC_INSTRUCTION_NONE && item->_instruction != CSYNC_INSTRUCTION_UPDATE_METADATA) {
break;
}
Q_FALLTHROUGH();
Copy link
Contributor

Choose a reason for hiding this comment

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

This is clever, and checkers of course know that macro. But not all people are Qt masters, and a comment what that macro does and how it changes the code flow would be great. As this changes the flow significantly.

Copy link
Member Author

Choose a reason for hiding this comment

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

If I start do document the Qt functions I'll be getting no where.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, you miss my point here.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get it either. The macro just hides a compiler warning that is enabled for a good reason. It's pretty standard, we use it a lot in the code base, and I think the name describes its purpose well enough. Do you want @TheOneRing to document the reason a switch-case is now used rather than a big if?

Copy link
Contributor

Choose a reason for hiding this comment

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

I know the macro, I learned what it does and yes, all good. Other people do not. And I think we should make understanding of code as easy as possible for people who are not experienced. And these Qt Macros are not very intuitive, so a little comment what the intention of this block is helps newcomers, just to lower the barrier. That is my only point. If you think that is not needed, ok.

Copy link
Member Author

Choose a reason for hiding this comment

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

It won't help with the readability but on master we can directly use:
https://en.cppreference.com/w/cpp/language/attributes/fallthrough

propagator()->_anotherSyncNeeded = true;
done(SyncFileItem::SoftError, tr("Local file changed during sync."));
done(SyncFileItem::Message, tr("Local file changed during syncing. It will be resumed."));
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure if "during syncing" is an accurate english term here. Maybe something like The local file is still busy. It will be resumed.?

Copy link
Member Author

Choose a reason for hiding this comment

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

I merged that error with the one a few lines above they where pretty identical.
In this case I don't think we need to describe it accurate but yes during sync is more correct grammar.

@sonarcloud
Copy link

sonarcloud bot commented Jan 26, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

propagator()->_anotherSyncNeeded = true;
done(SyncFileItem::SoftError, tr("Local file changed during sync."));
done(SyncFileItem::Message, tr("Local file changed during sync. It will be resumed."));
Copy link
Collaborator

Choose a reason for hiding this comment

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

resumed->retried?

Or maybe: "The next sync will retry to upload the file."

Copy link
Member Author

Choose a reason for hiding this comment

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

Delay until next sync?

@TheOneRing TheOneRing merged commit cc3b63f into 2.10 Jan 26, 2022
@delete-merged-branch delete-merged-branch bot deleted the work/changed_during_upload branch January 26, 2022 14:18
if (item->_instruction != CSYNC_INSTRUCTION_NONE && item->_instruction != CSYNC_INSTRUCTION_UPDATE_METADATA) {
break;
}
Q_FALLTHROUGH();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't get it either. The macro just hides a compiler warning that is enabled for a good reason. It's pretty standard, we use it a lot in the code base, and I think the name describes its purpose well enough. Do you want @TheOneRing to document the reason a switch-case is now used rather than a big if?

};
std::vector<std::pair<QString, SyncFileItem::Status>> otherStatusItems;
Copy link
Contributor

Choose a reason for hiding this comment

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

I didn't get that the first couple of times I was reading this code. Perhaps you should reverse the order in the pair?

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.

4 participants