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

[ISSUE #22] Improving codeCov for mqtt.common #89

Merged
merged 3 commits into from
May 6, 2022
Merged

[ISSUE #22] Improving codeCov for mqtt.common #89

merged 3 commits into from
May 6, 2022

Conversation

YxAc
Copy link
Contributor

@YxAc YxAc commented Apr 30, 2022

codeCov for mqtt.common to improving #22

if (resource != null && resource.contains("%")) {
int firstIndex = resource.indexOf("%");
if (resource != null && resource.contains(NAMESPACE_SPLITER)) {
int firstIndex = resource.indexOf(NAMESPACE_SPLITER);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using defined constant

} else {
return null;
}
return splitNamespaceStr(topic);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

encapsulate duplicate code block

if (invoke.minRt.get() > rt) {
invoke.minRt.set(rt);
}
addInvoke(key, 1, rt, success);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reusing 'addInvoke' method

@@ -31,7 +31,7 @@ public class TopicUtils {
* @return
*/
public static String normalizeTopic(String topic) {
if (topic == null) {
if (topic == null || topic.isEmpty()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

bug of 'empty str'

Copy link
Contributor

Choose a reason for hiding this comment

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

may be use StringUtils.isBlank(topic) will be better

Copy link
Contributor Author

Choose a reason for hiding this comment

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

may be use StringUtils.isBlank(topic) will be better

done

return null;
}
if (mqttTopic.getSecondTopic() == null || mqttTopic.getFirstTopic() == null) {
if (!isP2P(mqttTopic.getSecondTopic())) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

reserve the order of 'null judgment' and 'p2p judgment'

@YxAc
Copy link
Contributor Author

YxAc commented May 1, 2022

Wonder under what conditions the codecov-commenter will be triggered? @tianliuliu , thanks :-)

@tianliuliu
Copy link
Contributor

Wonder under what conditions the codecov-commenter will be triggered? @tianliuliu , thanks :-)

it can be triggered always, sometimes it dosen't work, maybe the bug itself.

@tianliuliu tianliuliu merged commit ac90d5c into apache:main May 6, 2022
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.

3 participants