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

Clean up/refactor InputCompletionPopup #4242

Merged
merged 1 commit into from
Dec 18, 2022

Conversation

pajlada
Copy link
Member

@pajlada pajlada commented Dec 18, 2022

Pull request checklist:

  • CHANGELOG.md was updated, if applicable

Description

Mainly flattening anon namespaces & respecting clang-tidy

Mainly flattening anon namespaces & respecting clang-tidy
@pajlada pajlada enabled auto-merge (squash) December 18, 2022 12:58
@pajlada pajlada merged commit 8830b0e into master Dec 18, 2022
@pajlada pajlada deleted the chore/refactor-input-completion-popup branch December 18, 2022 13:25
Copy link
Contributor

@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 made some suggestions

}
}

void addEmojis(std::vector<CompletionEmote> &out, const EmojiMap &map,
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: parameter 'out' is unused [misc-unused-parameters]

Suggested change
void addEmojis(std::vector<CompletionEmote> &out, const EmojiMap &map,
void addEmojis(const EmojiMap &map,

void InputCompletionPopup::updateEmotes(const QString &text, ChannelPtr channel)
{
std::vector<_Emote> emotes;
auto tc = dynamic_cast<TwitchChannel *>(channel.get());
std::vector<CompletionEmote> emotes;
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'emotes' is not initialized [cppcoreguidelines-init-variables]

Suggested change
std::vector<CompletionEmote> emotes;
std::vector<CompletionEmote> emotes = 0;

std::vector<_Emote> emotes;
auto tc = dynamic_cast<TwitchChannel *>(channel.get());
std::vector<CompletionEmote> emotes;
auto *tc = dynamic_cast<TwitchChannel *>(channel.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'tc' is not initialized [cppcoreguidelines-init-variables]

Suggested change
auto *tc = dynamic_cast<TwitchChannel *>(channel.get());
auto *tc = nullptr = dynamic_cast<TwitchChannel *>(channel.get());

@@ -160,45 +169,68 @@

void InputCompletionPopup::updateUsers(const QString &text, ChannelPtr channel)
{
auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get());
if (twitchChannel)
auto *tc = dynamic_cast<TwitchChannel *>(channel.get());
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'tc' is not initialized [cppcoreguidelines-init-variables]

Suggested change
auto *tc = dynamic_cast<TwitchChannel *>(channel.get());
auto *tc = nullptr = dynamic_cast<TwitchChannel *>(channel.get());

{
this->redrawTimer_.stop();
}

void InputCompletionPopup::initLayout()
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: method 'initLayout' can be made static [readability-convert-member-functions-to-static]

src/widgets/splits/InputCompletionPopup.hpp:33:

-     void initLayout();
+     static void initLayout();

auto channel = this->split_->getChannel().get();
auto tc = dynamic_cast<TwitchChannel *>(channel);
auto *channel = this->split_->getChannel().get();
auto *tc = dynamic_cast<TwitchChannel *>(channel);
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: variable 'tc' is not initialized [cppcoreguidelines-init-variables]

Suggested change
auto *tc = dynamic_cast<TwitchChannel *>(channel);
auto *tc = nullptr = dynamic_cast<TwitchChannel *>(channel);

assert(popup);

if (emoteCompletion) // autocomplete emotes
if (emoteCompletion)
Copy link
Contributor

Choose a reason for hiding this comment

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

warning: if with identical then and else branches [bugprone-branch-clone]

    if (emoteCompletion)
    ^

src/widgets/splits/SplitInput.cpp:761: else branch starts here

    else
    ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant