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

Refactor Replicate#getLastRelevantStatus to remove the Optional return type #524

Merged

Conversation

mcornaton
Copy link
Contributor

@mcornaton mcornaton requested a review from a team October 4, 2022 07:11

if (lastRelevantStatus.get().equals(ReplicateStatus.CONTRIBUTED)) {
ReplicateStatus lastRelevantStatus = replicate.getLastRelevantStatus();
if (lastRelevantStatus.equals(ReplicateStatus.CONTRIBUTED)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I tend to prefer the inverted syntax for NPE protection

Suggested change
if (lastRelevantStatus.equals(ReplicateStatus.CONTRIBUTED)) {
if (ReplicateStatus.CONTRIBUTED.equals(lastRelevantStatus)) {

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 == is a bit better for enums. Please see 566e532 :)

src/main/java/com/iexec/core/replicate/Replicate.java Outdated Show resolved Hide resolved
@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 4, 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 1 Code Smell

90.4% 90.4% Coverage
0.0% 0.0% Duplication

Copy link
Contributor

@jbern0rd jbern0rd left a comment

Choose a reason for hiding this comment

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

Nice work, many thanks

@mcornaton mcornaton merged commit 625d074 into develop Oct 4, 2022
@mcornaton mcornaton deleted the bugfix/remove-optional-from-getLastRelevantStatus branch October 4, 2022 11:11
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.

2 participants